using System; using System.Collections.Generic; using System.Text; using System.Data; namespace DAL { public class ClsGy_ClassTimePrjSub_Ctl:DBUtility.ClsGy_Base_Ctl { SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); //原代码 用于 替换子项目 public string HOldNumber; public Model.ClsGy_ClassTimePrjSub_Model oModel = new Model.ClsGy_ClassTimePrjSub_Model(); //新增 public override bool AddNew() { try { oCn.BeginTran(); oCn.RunProc("Insert into " + MvarItemKey + " " + " (HInterID,HMaker,HMakeDate,HSumWorkTimes" + ",HRate,HSumMoney,HYear,HPeriod" + ",HOldRate) " + " Values(" + oModel.HInterID + ",'" + oModel.HMaker + "','" + DBUtility.ClsPub.GetServerDate(-1) + "'," + oModel.HSumWorkTimes.ToString() + "," + oModel.HRate + "," + oModel.HSumMoney.ToString() + "," + oModel.HYear.ToString() + "," + oModel.HPeriod.ToString() + "," + oModel.HOldRate.ToString() + ")", ref DBUtility.ClsPub.sExeReturnInfo); //修改上级为非末级代码 //oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo); oCn.Commit(); return true; } catch (Exception e) { oCn.RollBack(); throw (e); } } //重复代码 public bool HavSameNumber(long sItemID, string sNumber) { DataSet DS; try { DS = oCn.RunProcReturn("Select HEntryID from Gy_ClassTimePrjSub Where HEntryID<>'" + sItemID + "' and HMaker='" + sNumber + "'", "Gy_ClassTimePrjSub"); if (DS.Tables[0].Rows.Count == 0) return false; else { return true; } } catch (Exception e) { return false; } } //删除 public bool DeleteByID(long sItemID) { try { oCn.RunProc("Delete from Gy_ClassTimePrjSub where HEntryID='" + sItemID + "'"); return true; } catch (Exception e) { return false; } } //计算平均工资 public bool GetAvgMoney(long HYear,long HPeriod,long HGroupID) { DataSet DS; try { DS = oCn.RunProcReturn("exec h_p_Pay_GetAvgMoney " + HYear.ToString() + "," + HPeriod.ToString() + "," + HGroupID.ToString(), "gy_czygl"); if (DS.Tables[0].Rows.Count == 0 || DS == null) { return false; } oModel.HSumMoney = DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0]["HSumMoney"]); oModel.HSumWorkTimes = DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0]["HSumWorkTimes"]); oModel.HRate = DBUtility.ClsPub.isDoule(DS.Tables[0].Rows[0]["HRate"]); return true; } catch (Exception e) { return false; } } //构造函数 public ClsGy_ClassTimePrjSub_Ctl() { MvarItemKey = "Gy_ClassTimePrjSub"; MvarReportTitle = "月度核算记录"; oModel = new Model.ClsGy_ClassTimePrjSub_Model(); } } }