private void SaveToolsButton_ServerClick(object sender, System.EventArgs e) { string WBSCode = Request.QueryString["WBSCode"]; EntityData entityUser = WBSDAO.GetTaskPersonByWBSCode(WBSCode); WBSDAO.DeleteTaskPerson(entityUser); try { DataRow dr; //责任人 dr = entityUser.GetNewRecord(); dr["TaskPersonCode"] = SystemManageDAO.GetNewSysCode("TaskPersonCode"); dr["WBSCode"] = WBSCode; dr["MainTask"] = this.txtMasterDetail.Value.Trim(); dr["UserCode"] = this.hMasterCode.Value; dr["Type"] = 2; entityUser.AddNewRecord(dr); //监督人 dr = entityUser.GetNewRecord(); dr["TaskPersonCode"] = SystemManageDAO.GetNewSysCode("TaskPersonCode"); dr["WBSCode"] = WBSCode; dr["MainTask"] = this.txtMonitorDetail.Value.Trim(); dr["UserCode"] = this.hMonitorCode.Value; dr["Type"] = 1; entityUser.AddNewRecord(dr); //执行人 System.Web.UI.WebControls.TextBox objText = new TextBox(); foreach (DataGridItem oDataGridItem in this.dgUserList.Items) { objText = (TextBox)oDataGridItem.FindControl("txtExecuterDetail"); dr = entityUser.GetNewRecord(); dr["TaskPersonCode"] = SystemManageDAO.GetNewSysCode("TaskPersonCode"); dr["WBSCode"] = WBSCode; dr["UserCode"] = this.dgUserList.DataKeys[oDataGridItem.ItemIndex]; dr["MainTask"] = objText.Text.Trim(); dr["Type"] = 0; entityUser.AddNewRecord(dr); } WBSDAO.SubmitAllTaskPerson(entityUser); entityUser.Dispose(); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, "保存相关人员失败"); } Response.Write(JavaScript.ScriptStart); Response.Write("window.opener.Select('Base','');"); Response.Write("window.close();"); Response.Write(JavaScript.ScriptEnd); }
private void AddNewEmptyCostChangeRow(EntityData entity, string contractCode, string contractChangeCode, int rows) { string contractCostChangeCode = ""; for (int i = 0; i < rows; i++) { DataRow drCostChange = entity.GetNewRecord("ContractCostChange"); contractCostChangeCode = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("ContractCostChangeCode"); drCostChange["ContractCostChangeCode"] = contractCostChangeCode; drCostChange["ContractCode"] = contractCode; drCostChange["ContractChangeCode"] = contractChangeCode; drCostChange["Money"] = Decimal.Zero; drCostChange["OriginalMoney"] = Decimal.Zero; drCostChange["TotalChangeMoney"] = Decimal.Zero; drCostChange["NewMoney"] = Decimal.Zero; drCostChange["ChangeMoney"] = Decimal.Zero; drCostChange["Cash"] = Decimal.Zero; drCostChange["OriginalCash"] = Decimal.Zero; drCostChange["TotalChangeCash"] = Decimal.Zero; drCostChange["NewCash"] = Decimal.Zero; drCostChange["ChangeCash"] = Decimal.Zero; drCostChange["Status"] = 1; entity.AddNewRecord(drCostChange, "ContractCostChange"); } }
/// <summary> /// 添加相关人员 /// </summary> /// <param name="strTWBSCode"></param> /// <param name="strUser"></param> /// <param name="strUserType"></param> private void AddUser(string strTWBSCode, string strUser, string strUserType, string strCode) { strUser = CutRepeat(strUser); EntityData entityDelUser = WBSDAO.GetTaskPersonByWBSCode(strTWBSCode); DataView dv = entityDelUser.CurrentTable.DefaultView; dv.RowFilter = " Type = '" + strUserType + "' and RoleType='0' and ExecuteCode='" + strCode + "'"; foreach (DataRowView drv in dv) { EntityData entityMyUser = WBSDAO.GetTaskPersonByCode(drv["TaskPersonCode"].ToString()); WBSDAO.DeleteTaskPerson(entityMyUser); entityMyUser.Dispose(); } string[] arUser = strUser.Split(','); EntityData entityUser = new EntityData("TaskPerson"); foreach (string sUser in arUser) { DataRow drUser = entityUser.GetNewRecord(); User objUser = (User)Session["User"]; drUser["WBSCode"] = strTWBSCode; drUser["TaskPersonCode"] = SystemManageDAO.GetNewSysCode("TaskPerson"); drUser["UserCode"] = sUser; drUser["Type"] = strUserType; drUser["RoleType"] = '0'; drUser["ExecuteCode"] = this.txtTaskExecuteCode.Value; entityUser.AddNewRecord(drUser); WBSDAO.InsertTaskPerson(entityUser); } entityUser.Dispose(); this.txtUsers.Value = ""; }
/// <summary> /// 增加新的提醒到提醒表 /// </summary> public static void SaveNewRemind(string strType, string strMasterCode, string strUser, string strMessage, DateTime StartDate, DateTime EndDate) { // 检查当前MasterCode当前用户是否有重复,如果有则更新 EntityData entity = RemindDAO.GetRemindObjectByMasterUser(strType, strMasterCode, strUser); if (entity.HasRecord()) { DataTable dt = entity.CurrentTable; for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["CreateDate"] = StartDate; dt.Rows[i]["EndDate"] = EndDate; } RemindDAO.UpdateRemindObject(entity); } else { EntityData entityRemind = new EntityData("RemindObject"); DataRow drRemind = entityRemind.GetNewRecord(); drRemind["RemindObjectCode"] = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("RemindObject"); drRemind["Type"] = strType; drRemind["User"] = strUser; drRemind["MasterCode"] = strMasterCode; drRemind["Message"] = strMessage; drRemind["CreateDate"] = StartDate; drRemind["EndDate"] = EndDate; drRemind["IsDesk"] = "1"; // 默认桌面显示 entityRemind.AddNewRecord(drRemind); RemindDAO.InsertRemindObject(entityRemind); entityRemind.Dispose(); } entity.Dispose(); }
/// <summary> /// 添加工作相关岗位 /// </summary> /// <param name="strTWBSCode"></param> /// <param name="strStation"></param> /// <param name="strStationType"></param> private void AddStation(string strTWBSCode, string strStation, string strUserType, string strCode) { strStation = CutRepeat(strStation); EntityData entityDelStation = WBSDAO.GetTaskPersonByWBSCode(strTWBSCode); DataView dv = entityDelStation.CurrentTable.DefaultView; dv.RowFilter = " Type = '" + strUserType + "' and RoleType='1' and ExecuteCode='" + strCode + "'"; foreach (DataRowView drv in dv) { EntityData entityMyStation = WBSDAO.GetTaskPersonByCode(drv["TaskPersonCode"].ToString()); WBSDAO.DeleteTaskPerson(entityMyStation); entityMyStation.Dispose(); } entityDelStation.Dispose(); string[] arStation = strStation.Split(','); EntityData entityStation = new EntityData("TaskPerson"); foreach (string sStation in arStation) { DataRow drStation = entityStation.GetNewRecord(); drStation["WBSCode"] = strTWBSCode; drStation["TaskPersonCode"] = SystemManageDAO.GetNewSysCode("TaskPerson"); drStation["UserCode"] = sStation; drStation["RoleType"] = "1"; // 1代表角色 drStation["Type"] = strUserType; drStation["ExecuteCode"] = this.txtTaskExecuteCode.Value; entityStation.AddNewRecord(drStation); WBSDAO.InsertTaskPerson(entityStation); } entityStation.Dispose(); }
private string AddNewEmptyChangeRow(EntityData entity, string contractCode) { string tableName = "ContractChange"; DataRow drChange = entity.GetNewRecord(tableName); string contractChangeCode = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("ContractChangeCode"); decimal TotalMoney, OriginalMoney, TotalChangeMoney; decimal ChangeMoney, NewMoney; TotalMoney = (decimal)entity.Tables["Contract"].Rows[0]["TotalMoney"]; OriginalMoney = (decimal)entity.Tables["Contract"].Rows[0]["OriginalMoney"]; TotalChangeMoney = TotalMoney - OriginalMoney; ChangeMoney = Decimal.Zero; NewMoney = TotalMoney + ChangeMoney; drChange["ContractChangeCode"] = contractChangeCode; drChange["ContractCode"] = contractCode; drChange["Money"] = TotalMoney; drChange["OriginalMoney"] = OriginalMoney; drChange["TotalChangeMoney"] = TotalChangeMoney; drChange["ChangeMoney"] = ChangeMoney; drChange["NewMoney"] = NewMoney; drChange["Status"] = 1; entity.AddNewRecord(drChange, tableName); return(contractChangeCode); }
//this.btSave.Click +=new EventHandler(btSave_Click); //this.rpFeedBack.ItemCommand +=new RepeaterCommandEventHandler(rpFeedBack_ItemCommand); #endregion private void btSave_Click(object sender, System.EventArgs e) { try { if (this.txtFeedBack.Text.Trim().Length <= 0) { Response.Write(Rms.Web.JavaScript.Alert(true, "请输入反馈内容")); return; } //EntityData entity = WBSDAO.GetFeedBackByMasterCode(this.strMasterCode); EntityData entity = WBSDAO.GetFeedBackByMasterCode(this.ViewState["MasterCode"].ToString()); DataRow dr = entity.GetNewRecord(); dr["FeedBackCode"] = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("FeedBack"); //dr["FeedBackType"] = this.strType; dr["FeedBackType"] = this.ViewState["FeedBackType"]; //dr["MasterCode"] = this.strMasterCode; dr["MasterCode"] = this.ViewState["MasterCode"]; dr["Content"] = (this.txtFeedBack.Text.Length > 4000)?this.txtFeedBack.Text.Substring(0, 4000):this.txtFeedBack.Text; dr["Author"] = ((User)Session["User"]).UserCode; dr["CreateDate"] = DateTime.Now; entity.AddNewRecord(dr); WBSDAO.InsertFeedBack(entity); entity.Dispose(); // 载入新数据 this.LoadData(); this.txtFeedBack.Text = ""; } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, "反馈保存失败"); Response.Write(Rms.Web.JavaScript.Alert(true, "反馈保存失败:" + ex.Message)); } }
private void AddHrUserInfo() { EntityData entity = new EntityData("OAPerson"); DataRow dr = entity.GetNewRecord(); string code = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("OAPerson"); dr["OAPersonCode"] = code; dr["workNo"] = txtSortID.Text.Trim(); dr["cname"] = UserName.Text; dr["homeplace"] = Address.Text.Trim(); if (Birthday.Value.Length > 0)// { dr["birthday"] = Birthday.Value; } else { dr["birthday"] = System.DBNull.Value; } dr["phone"] = Phone.Text.Trim(); dr["mobile"] = Mobile.Text.Trim(); if (male.Checked) { dr["sex"] = "DI69127"; // 男 } else { dr["sex"] = "DI69128"; // 女 } dr["Status"] = "1"; // 新增状态为在职 entity.AddNewRecord(dr); DAL.EntityDAO.OADAO.SubmitAllOAPerson(entity); entity.Dispose(); }
private EntityData SaveData() { EntityData entity = DAL.EntityDAO.OADAO.GetOAEquipmentApplyByCode(OAEquipmentApplyCode); if (this.tblEdit.Visible == true) { DataRow dr; if (this.WorkFlowToolbar1.ApplicationCode == "") { dr = entity.GetNewRecord(); OAEquipmentApplyCode = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("OAEquipmentApply"); } else { dr = entity.CurrentRow; } dr["OAEquipmentApplyCode"] = OAEquipmentApplyCode; dr["EquipmentName"] = EquipmentName.Value; dr["Unit"] = Unit.Value; dr["Configure"] = Configure.Value; dr["Purpose"] = Purpose.Value; if (ReqTime.Value.Length > 0) { dr["ReqTime"] = ReqTime.Value; } dr["ApplyUser"] = ApplyUser.Value; dr["Remark"] = Remark.Value; if (this.WorkFlowToolbar1.ApplicationCode == "") { entity.AddNewRecord(dr); } } return(entity); }
private static EntityData ImportSalPayByClient(string ClientCode, string ProjectCode, DataSet dsSrc, StandardEntityDAO dao) { EntityData data2; try { DataTable table = dsSrc.Tables["account"]; DataTable table2 = dsSrc.Tables["SalPayPlan"]; DataTable table3 = dsSrc.Tables["SalPayRela"]; dao.EntityName = "SalPay"; EntityData entitydata = new EntityData("SalPay"); string[] Params = new string[] { "@ClientCode" }; object[] values = new object[] { ClientCode }; dao.FillEntity(SqlManager.GetSqlStruct("SalPay", "SelectByClient").SqlString, Params, values, entitydata, "SalPay"); if (entitydata.HasRecord()) { dao.DeleteAllRow(entitydata); dao.DeleteEntity(entitydata); } for (int i = 0; i < table.Rows.Count; i++) { DataRow row = entitydata.CurrentTable.NewRow(); DataRow row2 = table.Rows[i]; row["ClientCode"] = ClientCode; row["ProjectCode"] = ProjectCode; row["PayCode"] = row2["account_code"]; row["AccountCode"] = row2["account_code"]; row["PayDate"] = row2["account_date"]; row["PayMoney"] = row2["account_price"]; row["PayType"] = row2["account_type"]; row["Remark"] = row2["remark"]; row["CheckDate"] = row2["check_date"]; row["CheckMan"] = row2["check_man"]; string text = ""; DataRow[] rowArray = table3.Select("account_code = '" + row2["account_code"].ToString() + "'"); if (rowArray.Length > 0) { string text2 = rowArray[0]["plan_code"].ToString(); if (text2 != "") { DataRow[] rowArray2 = table2.Select("pay_plan_code = '" + text2 + "'"); if (rowArray2.Length > 0) { text = rowArray2[0]["contract_code"].ToString(); } } } row["ContractCode"] = text; entitydata.AddNewRecord(row); dao.InsertEntity(entitydata); } data2 = entitydata; } catch (Exception exception) { throw exception; } return(data2); }
protected void btnSave_ServerClick(object sender, System.EventArgs e) { try { string Hint = ""; if (!CheckValid(ref Hint)) { Response.Write(Rms.Web.JavaScript.Alert(true, Hint)); return; } EntityData entity = DAL.EntityDAO.PaymentDAO.GetVoucherTypeByCode(this.txtOldCode.Value); DataRow dr = null; bool isNew = !entity.HasRecord(); if (entity.HasRecord()) { dr = entity.CurrentRow; } else { dr = entity.GetNewRecord(); dr["Code"] = this.txtCode.Value; entity.AddNewRecord(dr); } // dr["Code"] = this.txtCode.Value; dr["Name"] = this.txtName.Value; DAL.EntityDAO.PaymentDAO.SubmitAllVoucherType(entity); entity.Dispose(); //修改凭证编号 if ((!isNew) && (this.txtCode.Value != this.txtOldCode.Value)) { string sql = string.Format("update VoucherType set Code = '{0}' where Code = '{1}'", this.txtCode.Value, this.txtOldCode.Value); QueryAgent qa = new QueryAgent(); try { qa.ExecuteSql(sql); } finally { qa.Dispose(); } } this.txtOldCode.Value = this.txtCode.Value; } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); Response.Write(Rms.Web.JavaScript.Alert(true, "保存出错:" + ex.Message)); return; } CloseWindow(); }
protected void btnSave_ServerClick(object sender, System.EventArgs e) { try { string Hint = ""; if (!CheckValid(ref Hint)) { Response.Write(Rms.Web.JavaScript.Alert(true, Hint)); return; } string subjectSetCode = this.txtSubjectSetCode.Value; EntityData entity = DAL.EntityDAO.SubjectDAO.GetSubjectSetByCode(subjectSetCode); DataRow dr = null; bool isNew = !entity.HasRecord(); if (entity.HasRecord()) { dr = entity.CurrentRow; } else { subjectSetCode = BLL.SubjectRule.GetNextSubjectSetCode(); // subjectSetCode = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("SubjectSetCode"); this.txtSubjectSetCode.Value = subjectSetCode; dr = entity.GetNewRecord(); dr["SubjectSetCode"] = subjectSetCode; entity.AddNewRecord(dr); } dr["SubjectSetName"] = this.txtSubjectSetName.Value; dr["SubjectRule"] = this.txtSubjectRule.Value; dr["FinanceInterface"] = this.sltFinanceInterface.Value; dr["FinanceInterfaceExportName"] = this.sltFinanceInterfaceExportName.Value; dr["FinanceInterfaceUnit"] = this.sltFinanceInterfaceUnit.Value; dr["FinanceInterfaceSupplierCode"] = this.sltFinanceInterfaceSupplierCode.Value; dr["Remark"] = this.txtRemark.Value; if (isNew) { DAL.EntityDAO.SubjectDAO.InsertSubjectSet(entity); } else { DAL.EntityDAO.SubjectDAO.UpdateSubjectSet(entity); } entity.Dispose(); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); Response.Write(Rms.Web.JavaScript.Alert(true, "保存出错:" + ex.Message)); return; } CloseWindow(); }
public static string SetResourceAccessRange(string code, string classCode, string unitCode, ArrayList ar, bool isRefreshRight) { string text3; try { string resourceCode = GetResourceCode(code, classCode); bool flag = resourceCode == ""; EntityData entity = null; if (flag) { resourceCode = SystemManageDAO.GetNewSysCode("ResourceCode"); entity = new EntityData("Standard_Resource"); DataRow newRecord = entity.GetNewRecord(); newRecord["ResourceCode"] = resourceCode; newRecord["ClassCode"] = classCode; newRecord["UnitCode"] = unitCode; newRecord["RelationCode"] = code; entity.AddNewRecord(newRecord); } else { entity = ResourceDAO.GetStandard_ResourceByCode(resourceCode); entity.CurrentRow["unitCode"] = unitCode; } if (isRefreshRight) { entity.DeleteAllTableRow("AccessRange"); } entity.SetCurrentTable("AccessRange"); int count = ar.Count; for (int i = 0; i < count; i++) { AccessRange range = (AccessRange)ar[i]; foreach (string text2 in range.Operations.Split(new char[] { ',' })) { DataRow row = entity.GetNewRecord(); row["AccessRangeCode"] = SystemManageDAO.GetNewSysCode("AccessRangeCode"); row["ResourceCode"] = resourceCode; row["UnitCode"] = unitCode; row["OperationCode"] = text2; row["AccessRangeType"] = range.AccessRangeType; row["RelationCode"] = range.RelationCode; entity.AddNewRecord(row); } } ResourceDAO.SubmitAllStandard_Resource(entity); entity.Dispose(); text3 = resourceCode; } catch (Exception exception) { throw exception; } return(text3); }
private static EntityData ImportSalContractByClient(string ClientCode, string ProjectCode, DataSet dsSrc, StandardEntityDAO dao) { EntityData data2; try { DataTable table = dsSrc.Tables["Contract"]; dao.EntityName = "SalContract"; EntityData entitydata = new EntityData("SalContract"); string[] Params = new string[] { "@ClientCode" }; object[] values = new object[] { ClientCode }; dao.FillEntity(SqlManager.GetSqlStruct("SalContract", "SelectByClient").SqlString, Params, values, entitydata, "SalContract"); if (entitydata.HasRecord()) { dao.DeleteAllRow(entitydata); dao.DeleteEntity(entitydata); } for (int i = 0; i < table.Rows.Count; i++) { DataRow row = entitydata.CurrentTable.NewRow(); DataRow row2 = table.Rows[i]; string contractCode = row2["contract_code"].ToString(); row["ProjectCode"] = ProjectCode; row["ContractCode"] = contractCode; row["ContractID"] = row2["contract_id"]; row["ClientCode"] = row2["client_code"]; row["ClientName"] = row2["client_name"]; row["RoomCode"] = row2["room_code"]; row["ContractDate"] = row2["contract_date"]; row["TotalPrice"] = row2["total_price"]; row["FactPrice"] = row2["fact_price"]; row["UnitPrice"] = row2["unit_price"]; //row["Jiesuan"] = row2["jiesuan"]; // row["BofangCode"] = row2["bofang_code"]; row["ChamberName"] = row2["chamber"]; row["BuildDim"] = row2["build_dim"]; row["RoomDim"] = row2["room_dim"]; row["Room"] = row2["room"]; row["BuildingName"] = row2["build_name"]; //row["JiesuanDate"] = row2["jiesuan_date"]; string suplCodeByName = GetSuplCodeByName(GetSuplNameByContract(row["ContractID"].ToString(), 4), ProjectCode); row["SuplCode"] = suplCodeByName; string roomCode = ProductRule.GetRoomCodeByChamberRoomName(ConvertRule.ToString(row["ChamberName"]), ConvertRule.ToString(row["Room"]), ProjectCode); row["RoomCode"] = roomCode; UpdateRoomSalState(roomCode, contractCode); entitydata.AddNewRecord(row); dao.InsertEntity(entitydata); } data2 = entitydata; } catch (Exception exception) { throw exception; } return(data2); }
/// <summary> /// 保存 /// </summary> private void Save(DataTable tbDtl) { string paymentCode = this.txtPaymentCode.Value; string projectCode = this.txtProjectCode.Value; bool isNew = (this.txtIsNew.Value.Trim() == "1"); try { EntityData entity = null; DataRow dr = null; if (isNew) { entity = new EntityData("Standard_Payment"); dr = entity.GetNewRecord(); // paymentCode = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("PaymentCode"); // this.txtPaymentCode.Value = paymentCode; dr["PaymentCode"] = paymentCode; dr["PaymentID"] = paymentCode; dr["ProjectCode"] = projectCode; dr["ApplyPerson"] = base.user.UserCode; dr["ApplyDate"] = DateTime.Now.ToString("yyyy-MM-dd"); dr["Status"] = 0; entity.AddNewRecord(dr); } else { entity = DAL.EntityDAO.PaymentDAO.GetStandard_PaymentByCode(paymentCode); dr = entity.CurrentRow; } dr["Payer"] = "成本批量请款"; //非合同请款 dr["IsContract"] = 0; dr["ContractCode"] = ""; dr["GroupCode"] = this.ucGroup.Value; dr["PayDate"] = BLL.ConvertRule.ToDate(this.dtPayDate.Value); //明细总金额 dr["Money"] = BLL.MathRule.SumColumn(tbDtl, "ItemMoney"); SaveDetail(entity, tbDtl); DAL.EntityDAO.PaymentDAO.SubmitAllStandard_Payment(entity); entity.Dispose(); } catch (Exception ex) { throw ex; } }
private void AddEmptyRow(EntityData entity, string contractCode, string tableName, string keyColumnName, int rows) { for (int i = 0; i < rows; i++) { DataRow dr = entity.GetNewRecord(tableName); dr[keyColumnName] = DAL.EntityDAO.SystemManageDAO.GetNewSysCode(keyColumnName); dr["ContractCode"] = contractCode; entity.AddNewRecord(dr, tableName); } }
private void AddNewValueEmptyRow(EntityData entity, string contractCode, string tableName, string keyColumnName, int rows, int Is, string materialcode) { for (int i = 0; i < rows; i++) { DataRow dr = entity.GetNewRecord(tableName); dr[keyColumnName] = RmsPM.DAL.EntityDAO.SystemManageDAO.GetNewSysCode(keyColumnName); dr["ContractCode"] = contractCode; dr["MaterialCode"] = materialcode; entity.AddNewRecord(dr, tableName); } }
protected void btnSave_ServerClick(object sender, System.EventArgs e) { try { string mainCode = Request["MainCode"] + ""; string roleCode = Request["RoleCode"] + ""; string[] checkCodes = this.txtACode.Value.Split(new char[] { ',' }); EntityData role = DAL.EntityDAO.SystemManageDAO.GetStandard_RoleByCode(roleCode); FunctionStructureStrategyBuilder sb = new FunctionStructureStrategyBuilder(); sb.AddStrategy(new Strategy(FunctionStructureStrategyName.ChildTreeNode, mainCode)); QueryAgent qa = new QueryAgent(); EntityData entity = qa.FillEntityData("FunctionStructure", sb.BuildMainQueryString()); qa.Dispose(); role.SetCurrentTable("RoleOperation"); foreach (DataRow dr in role.CurrentTable.Select(String.Format(" OperationCode like '{0}%' ", mainCode))) { dr.Delete(); } foreach (string code in checkCodes) { if (code != "") { DataRow dr = role.GetNewRecord(); dr["RoleCode"] = roleCode; dr["OperationCode"] = code; role.AddNewRecord(dr); } } DAL.EntityDAO.SystemManageDAO.SubmitAllStandard_Role(role); entity.Dispose(); role.Dispose(); Response.Write(Rms.Web.JavaScript.ScriptStart); Response.Write(" window.opener.location.reload(); "); Response.Write(" window.navigate( 'ConfigRoleRight.aspx?RoleCode=" + roleCode + "' ); "); Response.Write(Rms.Web.JavaScript.ScriptEnd); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, "保存出错"); Response.Write(Rms.Web.JavaScript.Alert(true, "保存出错")); return; } }
private void SaveBuilding(string projectCode, string parentCode, string buildingName, int floorCount, string buildType, string curCode, string floorList, string roomlist, string unitProject) { try { string fullID = ""; int deep = 0; if (parentCode.Length > 0) { EntityData entity1 = ProductDAO.GetBuildingByCode(parentCode); if (entity1.HasRecord()) { fullID = entity1.GetString("FullID"); deep = entity1.GetInt("Layer"); } entity1.Dispose(); } EntityData entity = ProductDAO.GetBuildingByCode(""); DataRow dr = entity.GetNewRecord(); dr["BuildingCode"] = curCode; dr["ProjectCode"] = projectCode; dr["FloorCount"] = floorCount; dr["FloorList"] = floorList; dr["Room_list"] = roomlist; dr["BuildingName"] = buildingName; dr["BuildType"] = buildType; dr["IsArea"] = 2; dr["Layer"] = deep + 1; dr["ParentCode"] = parentCode; dr["objectX"] = 0; dr["objectY"] = 0; dr["UnitProject"] = unitProject; if (parentCode.Length > 0) { dr["FullID"] = fullID + "-" + curCode; } else { dr["FullID"] = curCode; } entity.AddNewRecord(dr); ProductDAO.InsertBuilding(entity); entity.Dispose(); } catch (Exception ex) { throw ex; } }
private bool SaveUserRole() { try { string UserCode = this.txtUserCode.Value; string select = this.txtSelectRoleCode.Value; string[] arr = select.Split(",".ToCharArray()); EntityData entity = DAL.EntityDAO.SystemManageDAO.GetUserRoleByUserCode(UserCode); entity.DeleteAllTableRow("UserRole"); //删除 // foreach(DataRow dr in tb.Rows) // { // string RoleCode = dr["RoleCode"].ToString(); // if (Array.IndexOf(arr, RoleCode) < 0) // { // dr.Delete(); // DAL.EntityDAO.SystemManageDAO.DeleteUserRole(entity); // } // } //添加 for (int i = 0; i < arr.Length; i++) { string RoleCode = arr[i]; if (RoleCode != "") { DataRow dr; dr = entity.GetNewRecord(); dr["UserCode"] = UserCode; dr["RoleCode"] = RoleCode; entity.AddNewRecord(dr); DAL.EntityDAO.SystemManageDAO.InsertUserRole(entity); } } entity.Dispose(); return(true); } catch (Exception ex) { this.lblMessage.Text = "添加角色用户失败"; ApplicationLog.WriteLog(this.ToString(), ex, "添加角色用户失败"); return(false); } }
private void AddNewEmptyCostPlanRow(EntityData entity, int pm_iRows) { for (int i = 0; i < pm_iRows; i++) { DataRow dr = entity.GetNewRecord("ContractCostPlan"); string code = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("ContractCostPlanCode"); dr["ContractCostPlanCode"] = code; dr["ContractCode"] = this.ContractCode; dr["ContractCostCode"] = this.ContractCostCode; entity.AddNewRecord(dr, "ContractCostPlan"); } }
protected void SaveToolsButton_ServerClick(object sender, System.EventArgs e) { try { EntityData entity = new EntityData("TaskGuid"); DataRow dr = entity.GetNewRecord(); string strCode = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("TaskGuid"); dr["TaskGuidCode"] = strCode; dr["WBSCode"] = this.strWBSCode; dr["TaskGuidContent"] = StringRule.FormartInput(this.arDetail.Value.Trim()); User user = (User)Session["User"]; dr["TaskGuidPerson"] = user.UserCode; dr["CreateDate"] = DateTime.Now; entity.AddNewRecord(dr); WBSDAO.InsertTaskGuid(entity); //保存当前工作参与人的资源 // 待加入分发范围记录 string strUser = this.txtUsers.Value.Trim(); if (strUser.Length > 0) { this.AddUser(this.strWBSCode, strUser, "5", strCode); // UserType为5是工作指示分发范围 } string strStation = this.txtStations.Value.Trim(); if (strStation.Length > 0) { this.AddStation(this.strWBSCode, strStation, "5", strCode); // UserType为5是工作指示分发范围 } // 取得当前工作参与人 // string strUsers = ""; // string strUserNames = ""; // string strStations = ""; // string strStationNames = ""; // BLL.ResourceRule.GetAccessRange(this.strWBSCode,"0701","070107",ref strUsers,ref strUserNames,ref strStations,ref strStationNames); // 取得责任人 strUser += "," + this.GetMaster(strWBSCode) + "," + base.user.UserCode; // 设定指示人权限加入资源 this.SaveRS(strCode, CutRepeat(strUser), CutRepeat(this.txtStations.Value), "070402"); this.JSAction(); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, "保存工作指示失败"); } }
protected void btnRefreshConfigUser_ServerClick(object sender, System.EventArgs e) { string[] codes = this.txtReturnUserCodes.Value.Split(new char[] { ',' }); try { EntityData ds = (EntityData)Session["StationEntityData"]; //清空原表记录 int c = ds.Tables["UserRole"].Rows.Count; for (int i = c - 1; i >= 0; i--) { ds.Tables["UserRole"].Rows[i].Delete(); } string StationCode = ds.GetString("StationCode"); foreach (string code in codes) { if (code != "") { if (ds.Tables["UserRole"].Select(String.Format("UserCode='{0}'", code)).Length == 0) { DataRow newDr = ds.GetNewRecord("UserRole"); newDr["UserRoleCode"] = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("UserRoleCode"); newDr["UserCode"] = code; newDr["StationCode"] = StationCode; ds.AddNewRecord(newDr, "UserRole"); } } } //记录当前的用户代码 this.txtReturnUserCodes.Value = BLL.ConvertRule.Concat(ds.Tables["UserRole"], "UserCode", ","); this.dgList.DataSource = ds.Tables["UserRole"]; this.dgList.DataBind(); Session["StationEntityData"] = ds; ds.Dispose(); btnSave.Visible = true; btnClose.Visible = true; } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); Response.Write(Rms.Web.JavaScript.Alert(true, "显示出错")); } }
private EntityData BuildData(string UserCodes) { EntityData sendMsgByCode = this.GetSendMsgByCode(""); foreach (string text in UserCodes.Split(new char[] { ',' })) { if (text != "") { this._SendMsgCode = SystemManageDAO.GetNewSysCode("SendMsg"); DataRow newRecord = sendMsgByCode.GetNewRecord(); if (this._SendMsgCode != null) { newRecord["SendMsgCode"] = this._SendMsgCode; } if (this._SendUsercode != null) { newRecord["SendUsercode"] = this._SendUsercode; } newRecord["ToUsercode"] = text; if (this._Msg != null) { newRecord["Msg"] = this._Msg; } if (this._Sendtime != null) { newRecord["Sendtime"] = this._Sendtime; } if (this._State != null) { newRecord["State"] = this._State; } if (this._senddel != null) { newRecord["senddel"] = this._senddel; } if (this._todel != null) { newRecord["todel"] = this._todel; } if (this._Flag != null) { newRecord["Flag"] = this._Flag; } sendMsgByCode.AddNewRecord(newRecord); } } return(sendMsgByCode); }
public static void Add(string TaxItems, string Range, decimal TaxRate, string TaxPayer, string Remarks) { using (SingleEntityDAO ydao = new SingleEntityDAO("StampDuty")) { EntityData entitydata = ydao.SelectbyPrimaryKey(0); DataRow newRecord = entitydata.GetNewRecord(); newRecord["StampDutyID"] = 0; newRecord["TaxItems"] = TaxItems; newRecord["Range"] = Range; newRecord["TaxRate"] = TaxRate; newRecord["TaxPayer"] = TaxPayer; newRecord["Remarks"] = Remarks; entitydata.AddNewRecord(newRecord); ydao.SubmitEntity(entitydata); } }
private void SaveToolsButton_ServerClick(object sender, System.EventArgs e) { try { DataRow dr; switch (this.hAction.Value) { case "VIEW": break; case "MODIFY": EntityData entityModify = WBSDAO.GetTaskPlanByCode(this.hCode.Value); dr = entityModify.CurrentRow; dr["Title"] = this.txtPlanTitle.Text.Trim(); dr["Content"] = this.arPlanContent.InnerText.Trim(); WBSDAO.UpdateTaskPlan(entityModify); entityModify.Dispose(); Response.Write(JavaScript.ScriptStart); Response.Write("window.opener.Update();"); Response.Write("window.close();"); Response.Write(JavaScript.ScriptEnd); break; case "INSERT": EntityData entityInsert = WBSDAO.GetAllTaskPlan(); dr = entityInsert.GetNewRecord(); dr["UserCode"] = base.user.UserCode; dr["ProjectCode"] = base.ProjectCode; dr["TaskPlanCode"] = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("TaskPlanCode"); dr["CheckFlag"] = 0; dr["Title"] = this.txtPlanTitle.Text.Trim(); dr["Content"] = this.arPlanContent.InnerText.Trim(); entityInsert.AddNewRecord(dr); WBSDAO.SubmitAllTaskPlan(entityInsert); entityInsert.Dispose(); Response.Write(JavaScript.ScriptStart); Response.Write("window.opener.Update();"); Response.Write("window.close();"); Response.Write(JavaScript.ScriptEnd); break; } } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); } }
private EntityData GetEntity() { string ud_sAction = Request.QueryString["Act"] + ""; string ud_sWorkFlowCommonCode = hidWorkFlowCommonCode.Value; EntityData entity = null; switch (ud_sAction) { case "Add": entity = new EntityData("WorkFlowCommon"); DataRow ud_drNew = entity.GetNewRecord(); ud_drNew["WorkFlowCommonCode"] = ud_sWorkFlowCommonCode; ud_drNew["ProcedureCode"] = this.hidProcedureCode.Value; ud_drNew["ProjectCode"] = this.hidProjectCode.Value; ud_drNew["Status"] = 0; ud_drNew["Creator"] = base.user.UserCode; ud_drNew["CreateDate"] = DateTime.Now; entity.AddNewRecord(ud_drNew); break; case "Edit": entity = RmsPM.DAL.EntityDAO.WorkFlowDAO.GetWorkFlowCommonByCode(ud_sWorkFlowCommonCode); break; } foreach (DataRow dr in entity.Tables["WorkFlowCommon"].Select(string.Format("WorkFlowCommonCode='{0}'", ud_sWorkFlowCommonCode))) { dr["WorkFlowTitle"] = this.txtWorkFlowTitle.Value.Trim(); dr["Unit"] = this.ucUnit.Value.Trim(); dr["WorkFlowID"] = this.txtWorkFlowID.Value.Trim(); dr["Type"] = this.inputSystemGroup.Value.Trim(); dr["Transactor"] = this.txtTransactor.Value.Trim(); dr["Content"] = this.ftbDetail.Text.Trim(); if (ud_sAction == "Edit") { dr["Modifier"] = base.user.UserCode; dr["ModifyDate"] = DateTime.Now; } } return(entity); }
private void ImportSalPay(string[] m_strSub, string ContractCode, string ProjectCode, StandardEntityDAO dao) { try { dao.EntityName = "SalPay"; EntityData entity = new EntityData("SalPay"); string[] os = { "@ContractCode" }; object[] ob = { ContractCode }; dao.FillEntity(SqlManager.GetSqlStruct("SalPay", "SelectByContract").SqlString, os, ob, entity, "SalPay"); if (entity.HasRecord()) { dao.DeleteAllRow(entity); dao.DeleteEntity(entity); } DataRow dr; dr = entity.CurrentTable.NewRow(); dr["ProjectCode"] = ProjectCode; dr["ContractCode"] = ContractCode; dr["ContractID"] = m_strSub[2]; dr["PayCode"] = m_strSub[2]; dr["AccountCode"] = m_strSub[2]; try { dr["PayMoney"] = m_strSub[9]; } catch { dr["PayMoney"] = 0; } entity.AddNewRecord(dr); dao.InsertEntity(entity); entity.Dispose(); } catch (Exception ex) { throw ex; } }
private void AddNewEmptyRow(EntityData entity, string wbsCode, string tableName, string keyColumnName, int rows) { for (int i = 0; i < rows; i++) { DataRow dr = entity.GetNewRecord(tableName); dr[keyColumnName] = DAL.EntityDAO.SystemManageDAO.GetNewSysCode(keyColumnName); dr["WBSCode"] = wbsCode; if (entity.Tables[tableName].Columns.Contains("PayConditionHtml")) { //付款条件 dr["PayConditionHtml"] = BLL.WBSRule.GetTaskBudgetPayConditionHtml(dr[keyColumnName].ToString(), entity.Tables["TaskBudgetCondition"], true); } entity.AddNewRecord(dr, tableName); } }
// 保存这个空预算 protected void btnSave_ServerClick(object sender, System.EventArgs e) { string cbsModuleCode = Request["CBSModuleCode"] + ""; bool isNew = (cbsModuleCode == ""); try { EntityData entity = null; DataRow dr = null; if (isNew) { entity = new EntityData("CBSModule"); dr = entity.GetNewRecord(); cbsModuleCode = DAL.EntityDAO.SystemManageDAO.GetNewSysCode("CBSModuleCode"); dr["CBSModuleCode"] = cbsModuleCode; entity.AddNewRecord(dr); } else { entity = DAL.EntityDAO.CBSDAO.GetCBSModuleByCode(cbsModuleCode); dr = entity.CurrentRow; } dr["CBSModuleName"] = this.txtName.Value; dr["Remark"] = this.txtRemark.Value; dr["CreatePerson"] = ((User)Session["User"]).UserCode; dr["CreateDate"] = DateTime.Now.Date; if (isNew) { DAL.EntityDAO.CBSDAO.InsertCBSModule(entity); } else { DAL.EntityDAO.CBSDAO.UpdateCBSModule(entity); } CloseWindow(cbsModuleCode); } catch (Exception ex) { ApplicationLog.WriteLog(this.ToString(), ex, ""); } }