void FrmBrmFactoryEdit_SaveOrUpdateEventHandler(Object sender, EditFormEventArgs e) { BRM_FACTORY_LOG faclog = new BRM_FACTORY_LOG(); BRM_FACTORY newfac = new BRM_FACTORY(); if (e.CurrentFormMode == Bparmaters.FormMode.AddNew) { ///需要加入防呆 newfac.ACTIVE = "Y"; newfac.FACTORY_KEY = this.GetGuidID; newfac.FACTORY_SERIAL_KEY = 1; newfac.FACTORY_DESC = this.txtFacDesc.Text.Trim(); newfac.FACTORY_NAME = this.txtFacName.Text.ToString(); newfac.FACTORY_ID = this.txtFacID.Text.ToString(); newfac.DAY_POINT = this.dptChangeDayPoint.Text.ToString(); newfac.WEEK_POINT = this.comboChangeWeekPoint.Text.ToString(); newfac.TRX_DATE = DateTime.Today.ToLocalTime().ToString(); newfac.TRX_LOGINID = LoginInfo.LoginID; newfac.HOLD_FLG = this.radioY.Checked == true ? "Y" : "N"; newfac.HOLD_DATE = this.dtpHoldDate.Value.ToString(); faclog.ACTIVE = newfac.ACTIVE; faclog.DAY_POINT = this.dptChangeDayPoint.Text.ToString(); faclog.WEEK_POINT = this.comboChangeWeekPoint.Text.ToString(); faclog.FACTORY_DESC = this.txtFacDesc.Text.Trim(); faclog.FACTORY_ID = newfac.FACTORY_ID; faclog.FACTORY_NAME = this.txtFacName.Text.Trim(); faclog.FACTORY_SERIAL_KEY = 1; faclog.HOLD_DATE = this.dtpHoldDate.Value.ToString(); faclog.HOLD_FLG = this.radioY.Checked == true ? "Y" : "N"; faclog.LOCAL_HOST_IP = ClientInfo.ClientInfo.LocalIP; faclog.LOCAL_HOST_NAME = ClientInfo.ClientInfo.LocaComputerlName; faclog.TRX_DATE = DateTime.Today.ToLocalTime().ToString(); faclog.TRX_LOGINID = LoginInfo.LoginID; faclog.TRX_MODE = Bparmaters.FormMode.AddNew.ToString(); faclog.FACTORY_KEY = newfac.FACTORY_KEY; newfac.Insert(); // faclog.Insert(); // } else if (e.CurrentFormMode == Bparmaters.FormMode.Modify) { String fackey = GetSelectedRowCellValueToString("FACTORY_KEY"); BRM_FACTORY oldfac = ServiceContainer.GetService <IBRMFactoryService>().FindFacByFacKey(fackey); oldfac.TRX_DATE = DateTime.Today.ToLocalTime().ToString(); oldfac.TRX_LOGINID = LoginInfo.LoginID; oldfac.FACTORY_NAME = this.txtFacName.Text.Trim(); oldfac.FACTORY_DESC = this.txtFacDesc.Text.Trim(); oldfac.HOLD_FLG = this.radioY.Checked == true ? "Y" : "N"; oldfac.HOLD_DATE = this.dtpHoldDate.Value.ToString(); oldfac.DAY_POINT = this.dptChangeDayPoint.Text.ToString(); oldfac.WEEK_POINT = this.comboChangeWeekPoint.Text.ToString(); oldfac.FACTORY_SERIAL_KEY = oldfac.FACTORY_SERIAL_KEY + 1; faclog.ACTIVE = oldfac.ACTIVE; faclog.DAY_POINT = this.dptChangeDayPoint.Text.ToString(); faclog.WEEK_POINT = this.comboChangeWeekPoint.Text.ToString(); faclog.FACTORY_DESC = this.txtFacDesc.Text.Trim(); faclog.FACTORY_ID = oldfac.FACTORY_ID; faclog.FACTORY_NAME = this.txtFacName.Text.Trim(); faclog.FACTORY_SERIAL_KEY = Convert.ToInt16(oldfac.FACTORY_SERIAL_KEY) + 1; faclog.HOLD_DATE = this.dtpHoldDate.Value.ToString(); faclog.HOLD_FLG = this.radioY.Checked == true ? "Y" : "N"; faclog.LOCAL_HOST_IP = ClientInfo.ClientInfo.LocalIP; faclog.LOCAL_HOST_NAME = ClientInfo.ClientInfo.LocaComputerlName; faclog.TRX_DATE = DateTime.Today.ToLocalTime().ToString(); faclog.TRX_LOGINID = LoginInfo.LoginID; faclog.TRX_MODE = Bparmaters.FormMode.Modify.ToString(); faclog.FACTORY_KEY = oldfac.FACTORY_KEY; oldfac.Update(); // faclog.Insert(); // } }
void FrmBaseFormTest_DeleteEventHandler(object sender,EventArgs e) { int bl = 0; if (this.dgvFactoryDetail.CurrentRow != null) { DataGridViewRow row = this.dgvFactoryDetail.CurrentRow; String key = row.Cells["FACTORY_KEY"].Value.ToString(); BRM_FACTORY fac = ServiceContainer.GetService<IBRMFactoryService>().FindFacByFacKey(key); if (fac == null) { MessageBox.Show("该笔资料不能进行删除,不存在或者已经处于活动状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { if (MessageBox.Show("确认要删除么?fackey=" + key, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { bl = ServiceContainer.GetService<IBRMFactoryService>().DelByFacKey(key); } catch { bl = 0; } if (bl == 0) { MessageBox.Show("删除失败", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information); } else { MessageBox.Show("删除成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); IAccount LoginInfo = EAS.Application.Instance.Session.Client as IAccount; BRM_FACTORY_LOG faclog = new BRM_FACTORY_LOG(); faclog.ACTIVE = "N"; faclog.DAY_POINT = fac.DAY_POINT; faclog.FACTORY_DESC = fac.FACTORY_DESC; faclog.FACTORY_ID = fac.FACTORY_ID; faclog.FACTORY_NAME = fac.FACTORY_NAME; faclog.FACTORY_SERIAL_KEY = Convert.ToInt16(fac.FACTORY_SERIAL_KEY)+1; faclog.HOLD_DATE = fac.HOLD_DATE; faclog.HOLD_FLG = fac.HOLD_FLG; faclog.LOCAL_HOST_IP = ClientInfo.ClientInfo.LocalIP; faclog.LOCAL_HOST_NAME = ClientInfo.ClientInfo.LocaComputerlName; faclog.TRX_DATE = DateTime.Today.ToLocalTime().ToString(); faclog.TRX_LOGINID = LoginInfo.LoginID; faclog.HOLD_FLG = fac.HOLD_FLG; faclog.TRX_MODE = "HIDE"; faclog.FACTORY_KEY = fac.FACTORY_KEY; faclog.Insert(); } } } } // MessageBox.Show("删除成功"); }
void FrmBrmFactoryEdit_SaveOrUpdateEventHandler(Object sender, EditFormEventArgs e) { BRM_FACTORY_LOG faclog = new BRM_FACTORY_LOG(); BRM_FACTORY newfac = new BRM_FACTORY(); if (e.CurrentFormMode == Bparmaters.FormMode.AddNew) { ///需要加入防呆 newfac.ACTIVE = "Y"; newfac.FACTORY_KEY = this.GetGuidID; newfac.FACTORY_SERIAL_KEY = 1; newfac.FACTORY_DESC = this.txtFacDesc.Text.Trim(); newfac.FACTORY_NAME = this.txtFacName.Text.ToString(); newfac.FACTORY_ID = this.txtFacID.Text.ToString(); newfac.DAY_POINT = this.dptChangeDayPoint.Text.ToString(); newfac.WEEK_POINT = this.comboChangeWeekPoint.Text.ToString(); newfac.TRX_DATE = DateTime.Today.ToLocalTime().ToString(); newfac.TRX_LOGINID = LoginInfo.LoginID; newfac.HOLD_FLG = this.radioY.Checked == true ? "Y" : "N"; newfac.HOLD_DATE = this.dtpHoldDate.Value.ToString(); faclog.ACTIVE = newfac.ACTIVE; faclog.DAY_POINT = this.dptChangeDayPoint.Text.ToString(); faclog.WEEK_POINT = this.comboChangeWeekPoint.Text.ToString(); faclog.FACTORY_DESC = this.txtFacDesc.Text.Trim(); faclog.FACTORY_ID = newfac.FACTORY_ID; faclog.FACTORY_NAME = this.txtFacName.Text.Trim(); faclog.FACTORY_SERIAL_KEY = 1; faclog.HOLD_DATE = this.dtpHoldDate.Value.ToString(); faclog.HOLD_FLG = this.radioY.Checked == true ? "Y" : "N"; faclog.LOCAL_HOST_IP = ClientInfo.ClientInfo.LocalIP; faclog.LOCAL_HOST_NAME = ClientInfo.ClientInfo.LocaComputerlName; faclog.TRX_DATE = DateTime.Today.ToLocalTime().ToString(); faclog.TRX_LOGINID = LoginInfo.LoginID; faclog.TRX_MODE = Bparmaters.FormMode.AddNew.ToString(); faclog.FACTORY_KEY = newfac.FACTORY_KEY; newfac.Insert();// faclog.Insert();// } else if (e.CurrentFormMode == Bparmaters.FormMode.Modify) { String fackey = GetSelectedRowCellValueToString("FACTORY_KEY"); BRM_FACTORY oldfac = ServiceContainer.GetService<IBRMFactoryService>().FindFacByFacKey(fackey); oldfac.TRX_DATE = DateTime.Today.ToLocalTime().ToString(); oldfac.TRX_LOGINID = LoginInfo.LoginID; oldfac.FACTORY_NAME = this.txtFacName.Text.Trim(); oldfac.FACTORY_DESC = this.txtFacDesc.Text.Trim(); oldfac.HOLD_FLG = this.radioY.Checked == true ? "Y" : "N"; oldfac.HOLD_DATE = this.dtpHoldDate.Value.ToString(); oldfac.DAY_POINT = this.dptChangeDayPoint.Text.ToString(); oldfac.WEEK_POINT = this.comboChangeWeekPoint.Text.ToString(); oldfac.FACTORY_SERIAL_KEY = oldfac.FACTORY_SERIAL_KEY + 1; faclog.ACTIVE = oldfac.ACTIVE; faclog.DAY_POINT = this.dptChangeDayPoint.Text.ToString(); faclog.WEEK_POINT = this.comboChangeWeekPoint.Text.ToString(); faclog.FACTORY_DESC = this.txtFacDesc.Text.Trim(); faclog.FACTORY_ID = oldfac.FACTORY_ID; faclog.FACTORY_NAME = this.txtFacName.Text.Trim(); faclog.FACTORY_SERIAL_KEY = Convert.ToInt16(oldfac.FACTORY_SERIAL_KEY) + 1; faclog.HOLD_DATE = this.dtpHoldDate.Value.ToString(); faclog.HOLD_FLG = this.radioY.Checked == true ? "Y" : "N"; faclog.LOCAL_HOST_IP = ClientInfo.ClientInfo.LocalIP; faclog.LOCAL_HOST_NAME = ClientInfo.ClientInfo.LocaComputerlName; faclog.TRX_DATE = DateTime.Today.ToLocalTime().ToString(); faclog.TRX_LOGINID = LoginInfo.LoginID; faclog.TRX_MODE = Bparmaters.FormMode.Modify.ToString(); faclog.FACTORY_KEY = oldfac.FACTORY_KEY; oldfac.Update();// faclog.Insert();// } }
void FrmBaseFormTest_DeleteEventHandler(object sender, EventArgs e) { int bl = 0; if (this.dgvFactoryDetail.CurrentRow != null) { DataGridViewRow row = this.dgvFactoryDetail.CurrentRow; String key = row.Cells["FACTORY_KEY"].Value.ToString(); BRM_FACTORY fac = ServiceContainer.GetService <IBRMFactoryService>().FindFacByFacKey(key); if (fac == null) { MessageBox.Show("该笔资料不能进行删除,不存在或者已经处于活动状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { if (MessageBox.Show("确认要删除么?fackey=" + key, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { bl = ServiceContainer.GetService <IBRMFactoryService>().DelByFacKey(key); } catch { bl = 0; } if (bl == 0) { MessageBox.Show("删除失败", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information); } else { MessageBox.Show("删除成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); IAccount LoginInfo = EAS.Application.Instance.Session.Client as IAccount; BRM_FACTORY_LOG faclog = new BRM_FACTORY_LOG(); faclog.ACTIVE = "N"; faclog.DAY_POINT = fac.DAY_POINT; faclog.FACTORY_DESC = fac.FACTORY_DESC; faclog.FACTORY_ID = fac.FACTORY_ID; faclog.FACTORY_NAME = fac.FACTORY_NAME; faclog.FACTORY_SERIAL_KEY = Convert.ToInt16(fac.FACTORY_SERIAL_KEY) + 1; faclog.HOLD_DATE = fac.HOLD_DATE; faclog.HOLD_FLG = fac.HOLD_FLG; faclog.LOCAL_HOST_IP = ClientInfo.ClientInfo.LocalIP; faclog.LOCAL_HOST_NAME = ClientInfo.ClientInfo.LocaComputerlName; faclog.TRX_DATE = DateTime.Today.ToLocalTime().ToString(); faclog.TRX_LOGINID = LoginInfo.LoginID; faclog.HOLD_FLG = fac.HOLD_FLG; faclog.TRX_MODE = "HIDE"; faclog.FACTORY_KEY = fac.FACTORY_KEY; faclog.Insert(); } } } } // MessageBox.Show("删除成功"); }