protected override void OnLoad(EventArgs e) { base.OnLoad(e); MachineMaster_mmt_Info machineInfoEntity; this.ppgList.Font = ControlSetting.ListFont; if (this.BaseParam != null) { machineInfoEntity = this.BaseParam as MachineMaster_mmt_Info; machineInfoEntity = _MachineMasterBL.DisplayRecord(machineInfoEntity); } else { machineInfoEntity = new MachineMaster_mmt_Info(); } MachineProperty wmp = new MachineProperty(); wmp.mmt_cMachineID = machineInfoEntity.mmt_cMachineID; wmp.mmt_cMachineName = machineInfoEntity.mmt_cMachineName; //wmp.cAreaName = machineInfoEntity.cAreaName; wmp.mmt_cAreaID = machineInfoEntity.mmt_cAreaID.ToString(); wmp.mmt_cLocation = machineInfoEntity.mmt_cLocation; wmp.mmt_cPressCode = machineInfoEntity.mmt_cPressCode; wmp.mmt_cMachineType = machineInfoEntity.mmt_cMachineType; wmp.mmt_cModel = machineInfoEntity.mmt_cModel; wmp.mmt_iMaxPaperSizeL = machineInfoEntity.mmt_iMaxPaperSizeL; wmp.mmt_iMaxPaperSizeW = machineInfoEntity.mmt_iMaxPaperSizeW; wmp.mmt_iMinPaperSizeL = machineInfoEntity.mmt_iMinPaperSizeL; wmp.mmt_iMinPaperSizeW = machineInfoEntity.mmt_iMinPaperSizeW; wmp.mmt_iIsPublic = (CustEnum.ChineseYesNo)Enum.Parse(typeof(CustEnum.ChineseYesNo), machineInfoEntity.IsPublic); wmp.mmt_lActive = (CustEnum.ChineseYesNo)Enum.Parse(typeof(CustEnum.ChineseYesNo), machineInfoEntity.IsActive); if (this.EditState == Common.DefineConstantValue.EditStateEnum.OE_Update) { base.SetPropertyReadOnly(wmp, true, "mmt_cMachineID"); } else { base.SetPropertyReadOnly(wmp, false, "mmt_cMachineID"); } this.ppgList.SelectedObject = wmp; InitSysBar(); }
private void btnSave_Click(object sender, EventArgs e) { if (lvwMachine.CheckedItems.Count > 0) { List<MachineMaster_mmt_Info> machines = new List<MachineMaster_mmt_Info>(); foreach (ListViewItem item in lvwMachine.CheckedItems) { MachineMaster_mmt_Info machine = new MachineMaster_mmt_Info(); machine.mmt_cMachineID = item.SubItems[0].Text; machines.Add(machine); } try { bool isSuccess = this._areaMasterBL.AddInArea(this._currentAreMaster, machines); if (isSuccess) { ShowInformationMessage("保存成功!"); this.Close(); } else { ShowErrorMessage("保存失敗!"); } } catch (Exception Ex) { throw Ex; } } }
public List<MachineMaster_mmt_Info> FindRecord(MachineMaster_mmt_Info info) { List<MachineMaster_mmt_Info> list = _MachineMasterDA.FindRecord(info); string space = ""; space = space.PadLeft(4); foreach (var item in list) { item.mmt_cMachineName = item.mmt_cMachineID + space + item.mmt_cMachineID; } return list; }
public Model.General.ReturnValueInfo Save(Model.IModel.IModelObject itemEntity, Common.DefineConstantValue.EditStateEnum EditMode) { Model.General.ReturnValueInfo returnValue = new Model.General.ReturnValueInfo(); MachineMaster_mmt_Info info = new MachineMaster_mmt_Info(); returnValue.messageText = ""; info = itemEntity as MachineMaster_mmt_Info; switch (EditMode) { case Common.DefineConstantValue.EditStateEnum.OE_Insert: bool isExist = false; isExist = _MachineMasterDA.IsExistRecord(info); if (!isExist) { returnValue.boolValue = _MachineMasterDA.InsertRecord(info); } else { returnValue.boolValue = false; returnValue.messageText = "数据重复!"; } break; case Common.DefineConstantValue.EditStateEnum.OE_Update: returnValue.boolValue = _MachineMasterDA.UpdateRecord(info); break; case Common.DefineConstantValue.EditStateEnum.OE_Delete: returnValue.boolValue = _MachineMasterDA.DeleteRecord(info); break; default: break; } return returnValue; }
/// <summary> /// 獲取後台數據庫機台主檔 /// </summary> /// <param name="machineID"></param> /// <returns></returns> public MachineMaster_mmt_Info GetMachineMasterInfo(string machineID) { try { MachineMaster_mmt_Info cond = new MachineMaster_mmt_Info(); cond.mmt_cMachineID = machineID; return this._MachineMasterDA.DisplayRecord(cond); } catch (Exception ex) { Common.General.BLLoger.Error(ex); return null; // throw Ex; } }
/// <summary> /// 取得機台列表 /// </summary> /// <returns></returns> public List<MachineMaster_mmt_Info> GetMachineInfo() { List<MachineMaster_mmt_Info> machineList = new List<MachineMaster_mmt_Info>(); string strSql = string.Empty; strSql += "select mmt_cMachineID," + Environment.NewLine; strSql += "mmt_cPressCode," + Environment.NewLine; strSql += "mmt_cMachineName," + Environment.NewLine; strSql += "amr_cAreaName as cAreaName," + Environment.NewLine; strSql += "mmt_cLocation," + Environment.NewLine; strSql += "amr_cAreaCode as cAreaCode" + Environment.NewLine; strSql += "from MachineMaster_mmt(NOLOCK)" + Environment.NewLine; strSql += "left join AreaMaster_amr" + Environment.NewLine; strSql += "on amr_cRecordID=mmt_cAreaID" + Environment.NewLine; strSql += "where mmt_lActive=1" + Environment.NewLine; try { using (SqlDataReader reader = DbHelperSQL.ExecuteReader(strSql)) { while (reader.Read()) { #region 屬性賦值 MachineMaster_mmt_Info machineInfo = new MachineMaster_mmt_Info(); if (reader["mmt_cMachineID"] != null && reader["mmt_cMachineID"].ToString() != string.Empty) { machineInfo.mmt_cMachineID = reader["mmt_cMachineID"].ToString(); } if (reader["mmt_cPressCode"] != null && reader["mmt_cPressCode"].ToString() != string.Empty) { machineInfo.mmt_cPressCode = reader["mmt_cPressCode"].ToString(); } if (reader["mmt_cMachineName"] != null && reader["mmt_cMachineName"].ToString() != string.Empty) { machineInfo.mmt_cMachineName = reader["mmt_cMachineName"].ToString(); } if (reader["cAreaName"] != null && reader["cAreaName"].ToString() != string.Empty) { machineInfo.cAreaName = reader["cAreaName"].ToString(); } if (reader["mmt_cLocation"] != null && reader["mmt_cLocation"].ToString() != string.Empty) { machineInfo.mmt_cLocation = reader["mmt_cLocation"].ToString(); } if (reader["cAreaCode"] != null && reader["cAreaCode"].ToString() != string.Empty) { machineInfo.cAreaCode = reader["cAreaCode"].ToString(); } #endregion machineList.Add(machineInfo); } } } catch (Exception Ex) { throw Ex; } return machineList; }
/// <summary> /// 取得沒有綁定普通班次群組的機台列表 /// </summary> /// <returns></returns> public List<MachineMaster_mmt_Info> GetFreeMachineInfo() { List<MachineMaster_mmt_Info> machineList = new List<MachineMaster_mmt_Info>(); string strSql = string.Empty; strSql += "select mmt_cMachineID," + Environment.NewLine; strSql += "mmt_cPressCode," + Environment.NewLine; strSql += "mmt_cMachineName," + Environment.NewLine; strSql += "amr_cAreaName as cAreaName," + Environment.NewLine; strSql += "mmt_cLocation," + Environment.NewLine; strSql += "amr_cAreaCode as cAreaCode" + Environment.NewLine; strSql += "from MachineMaster_mmt(NOLOCK)" + Environment.NewLine; strSql += "left join AreaMaster_amr" + Environment.NewLine; strSql += "on amr_cRecordID=mmt_cAreaID" + Environment.NewLine; strSql += "where mmt_lActive=1" + Environment.NewLine; strSql += "and mmt_cMachineID not in" + Environment.NewLine; strSql += "(" + Environment.NewLine; strSql += "select distinct mstg_cMachineID " + Environment.NewLine; strSql += "from MachineShiftTypeGroup_mstg" + Environment.NewLine; strSql += "inner join ShiftTypeGroup_stg" + Environment.NewLine; strSql += "on stg_GroupID=mstg_GroupID " + Environment.NewLine; strSql += "and stg_cGroupType='" + Common.DefineConstantValue.MachineShiftSettingTypeDefine.CommonSetting + "'" + Environment.NewLine; strSql += ")" + Environment.NewLine; try { using (SqlDataReader reader = DbHelperSQL.ExecuteReader(strSql)) { while (reader.Read()) { #region 屬性賦值 MachineMaster_mmt_Info machineInfo = new MachineMaster_mmt_Info(); if (reader["mmt_cMachineID"] != null && reader["mmt_cMachineID"].ToString() != string.Empty) { machineInfo.mmt_cMachineID = reader["mmt_cMachineID"].ToString(); } if (reader["mmt_cPressCode"] != null && reader["mmt_cPressCode"].ToString() != string.Empty) { machineInfo.mmt_cPressCode = reader["mmt_cPressCode"].ToString(); } if (reader["mmt_cMachineName"] != null && reader["mmt_cMachineName"].ToString() != string.Empty) { machineInfo.mmt_cMachineName = reader["mmt_cMachineName"].ToString(); } if (reader["cAreaName"] != null && reader["cAreaName"].ToString() != string.Empty) { machineInfo.cAreaName = reader["cAreaName"].ToString(); } if (reader["mmt_cLocation"] != null && reader["mmt_cLocation"].ToString() != string.Empty) { machineInfo.mmt_cLocation = reader["mmt_cLocation"].ToString(); } if (reader["cAreaCode"] != null && reader["cAreaCode"].ToString() != string.Empty) { machineInfo.cAreaCode = reader["cAreaCode"].ToString(); } #endregion machineList.Add(machineInfo); } } } catch (Exception Ex) { throw Ex; } return machineList; }
public List<MachineMaster_mmt_Info> FindRecord(MachineMaster_mmt_Info info) { return base.FindEntities<MachineMaster_mmt_Info>(info).ToList(); }
/// <summary> /// 獲取指定數據庫連接的機台主檔信息 /// </summary> /// <param name="strSql">SQL查詢語句</param> /// <param name="strConn">數據庫連接字符串</param> /// <returns></returns> private MachineMaster_mmt_Info GetMachineMasterInfo(string strSql, string strConn) { if (string.IsNullOrEmpty(strSql) || string.IsNullOrEmpty(strConn)) { return null; } MachineMaster_mmt_Info macInfo = null; try { using (SqlDataReader reader = DbHelperSQL.ExecuteReader(strConn, strSql)) { #region 逐個屬性賦值 if (reader.Read()) { macInfo = new MachineMaster_mmt_Info(); macInfo.DBType = GetDBType(strConn); if (reader["mmt_cMachineID"] != null && reader["mmt_cMachineID"].ToString() != string.Empty) { macInfo.mmt_cMachineID = reader["mmt_cMachineID"].ToString(); } if (reader["mmt_cBrandName"] != null && reader["mmt_cBrandName"].ToString() != string.Empty) { macInfo.mmt_cBrandName = reader["mmt_cBrandName"].ToString(); } if (reader["mmt_cLocation"] != null && reader["mmt_cLocation"].ToString() != string.Empty) { macInfo.mmt_cLocation = reader["mmt_cLocation"].ToString(); } if (reader["mmt_cPressCode"] != null && reader["mmt_cPressCode"].ToString() != string.Empty) { macInfo.mmt_cPressCode = reader["mmt_cPressCode"].ToString(); } if (reader["mmt_cModel"] != null && reader["mmt_cModel"].ToString() != string.Empty) { macInfo.mmt_cModel = reader["mmt_cModel"].ToString(); } if (reader["mmt_iMaxPaperSizeL"] != null && reader["mmt_iMaxPaperSizeL"].ToString() != string.Empty) { macInfo.mmt_iMaxPaperSizeL = int.Parse(reader["mmt_iMaxPaperSizeL"].ToString()); } if (reader["mmt_iMaxPaperSizeW"] != null && reader["mmt_iMaxPaperSizeW"].ToString() != string.Empty) { macInfo.mmt_iMaxPaperSizeW = int.Parse(reader["mmt_iMaxPaperSizeW"].ToString()); } if (reader["mmt_cRmk"] != null && reader["mmt_cRmk"].ToString() != string.Empty) { macInfo.mmt_cRmk = reader["mmt_cRmk"].ToString(); } if (reader["mmt_cMachineType"] != null && reader["mmt_cMachineType"].ToString() != string.Empty) { macInfo.mmt_cMachineType = reader["mmt_cMachineType"].ToString(); } if (reader["mmt_cAddBy"] != null && reader["mmt_cAddBy"].ToString() != string.Empty) { macInfo.mmt_cAddBy = reader["mmt_cAddBy"].ToString(); } if (reader["mmt_dAddDate"] != null && reader["mmt_dAddDate"].ToString() != string.Empty) { macInfo.mmt_dAddDate = DateTime.Parse(reader["mmt_dAddDate"].ToString()); } if (reader["mmt_cLastBy"] != null && reader["mmt_cLastBy"].ToString() != string.Empty) { macInfo.mmt_cLastBy = reader["mmt_cLastBy"].ToString(); } if (reader["mmt_dLastDate"] != null && reader["mmt_dLastDate"].ToString() != string.Empty) { macInfo.mmt_dLastDate = DateTime.Parse(reader["mmt_dLastDate"].ToString()); } if (reader["mmt_iMinPaperSizeL"] != null && reader["mmt_iMinPaperSizeL"].ToString() != string.Empty) { macInfo.mmt_iMinPaperSizeL = int.Parse(reader["mmt_iMinPaperSizeL"].ToString()); } if (reader["mmt_iMinPaperSizeW"] != null && reader["mmt_iMinPaperSizeW"].ToString() != string.Empty) { macInfo.mmt_iMinPaperSizeW = int.Parse(reader["mmt_iMinPaperSizeW"].ToString()); } if (reader["mmt_cAreaID"] != null && reader["mmt_cAreaID"].ToString() != string.Empty) { macInfo.mmt_cAreaID = new Guid(reader["mmt_cAreaID"].ToString()); } if (reader["mmt_iIsPublic"] != null && reader["mmt_iIsPublic"].ToString() != string.Empty) { macInfo.mmt_iIsPublic = bool.Parse(reader["mmt_iIsPublic"].ToString()); } if (reader["mmt_cMachineName"] != null && reader["mmt_cMachineName"].ToString() != string.Empty) { macInfo.mmt_cMachineName = reader["mmt_cMachineName"].ToString(); } if (reader["mmt_lActive"] != null && reader["mmt_lActive"].ToString() != string.Empty) { macInfo.mmt_lActive = bool.Parse(reader["mmt_lActive"].ToString()); } if (reader["cAreaCode"] != null && reader["cAreaCode"].ToString() != string.Empty) { macInfo.cAreaCode = reader["cAreaCode"].ToString(); } if (reader["cAreaName"] != null && reader["cAreaName"].ToString() != string.Empty) { macInfo.cAreaName = reader["cAreaName"].ToString(); } if (reader["MachineTypeName"] != null && reader["MachineTypeName"].ToString() != string.Empty) { macInfo.MachineTypeName = reader["MachineTypeName"].ToString(); } } #endregion } } catch (Exception ex) { throw ex; } return macInfo; }
/// <summary> /// 保存群組機台 /// </summary> /// <returns></returns> private bool SaveShiftTypeGroupMachineInfo() { List<MachineMaster_mmt_Info> selectedMachines = new List<MachineMaster_mmt_Info>(); bool isSuccess = false; foreach (ListViewItem selectData in lvwSelectMachine.Items) { MachineMaster_mmt_Info machine = new MachineMaster_mmt_Info(); machine.mmt_cMachineID = selectData.SubItems[(int)EnumSelectdMacInfoColumn.MacID].Text.Trim(); selectedMachines.Add(machine); } try { isSuccess = this.m_machineShiftSettingBLL.AddShiftTypeGroupMachineInfo(selectedMachines, this.m_selectedGroupID); } catch (Exception Ex) { ShowErrorMessage(Ex.Message); } return isSuccess; }
/// <summary> /// 機台主檔 /// </summary> public List<MachineMaster_mmt_Info> GetMachineMaster() { try { List<MachineMaster_mmt_Info> list = new List<MachineMaster_mmt_Info>(); StringBuilder strSql = new StringBuilder(); strSql.AppendLine("select"); strSql.AppendLine("mmt_cMachineID,mmt_cLocation,mmt_cPressCode,mmt_cModel"); strSql.AppendLine(",mmt_iMaxPaperSizeL,mmt_iMaxPaperSizeW,mmt_cMachineType,mmt_cAddBy,mmt_dAddDate,mmt_cLastBy,mmt_dLastDate"); strSql.AppendLine(",mmt_iMinPaperSizeL,mmt_iMinPaperSizeW,mmt_cAreaID,mmt_iIsPublic,mmt_cMachineName,mmt_lActive "); strSql.AppendLine("from MachineMaster_mmt "); strSql.AppendLine("where mmt_lActive=1 "); using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString())) { while (sdr.Read()) { MachineMaster_mmt_Info model = new MachineMaster_mmt_Info(); if (sdr["mmt_cMachineID"] != null && sdr["mmt_cMachineID"].ToString() != "") { model.mmt_cMachineID = sdr["mmt_cMachineID"].ToString(); } if (sdr["mmt_cLocation"] != null && sdr["mmt_cLocation"].ToString() != "") { model.mmt_cLocation = sdr["mmt_cLocation"].ToString(); } if (sdr["mmt_cPressCode"] != null && sdr["mmt_cPressCode"].ToString() != "") { model.mmt_cPressCode = sdr["mmt_cPressCode"].ToString(); } if (sdr["mmt_cModel"] != null && sdr["mmt_cModel"].ToString() != "") { model.mmt_cModel = sdr["mmt_cModel"].ToString(); } if (sdr["mmt_iMaxPaperSizeL"] != null && sdr["mmt_iMaxPaperSizeL"].ToString() != "") { model.mmt_iMaxPaperSizeL = int.Parse(sdr["mmt_iMaxPaperSizeL"].ToString()); } if (sdr["mmt_iMaxPaperSizeW"] != null && sdr["mmt_iMaxPaperSizeW"].ToString() != "") { model.mmt_iMaxPaperSizeW = int.Parse(sdr["mmt_iMaxPaperSizeW"].ToString()); } if (sdr["mmt_cMachineType"] != null && sdr["mmt_cMachineType"].ToString() != "") { model.mmt_cMachineType = sdr["mmt_cMachineType"].ToString(); } if (sdr["mmt_cAddBy"] != null && sdr["mmt_cAddBy"].ToString() != "") { model.mmt_cAddBy = sdr["mmt_cAddBy"].ToString(); } if (sdr["mmt_dAddDate"] != null && sdr["mmt_dAddDate"].ToString() != "") { model.mmt_dAddDate = DateTime.Parse(sdr["mmt_dAddDate"].ToString()); } if (sdr["mmt_cLastBy"] != null && sdr["mmt_cLastBy"].ToString() != "") { model.mmt_cLastBy = sdr["mmt_cLastBy"].ToString(); } if (sdr["mmt_dLastDate"] != null && sdr["mmt_dLastDate"].ToString() != "") { model.mmt_dLastDate = DateTime.Parse(sdr["mmt_dLastDate"].ToString()); } if (sdr["mmt_iMinPaperSizeL"] != null && sdr["mmt_iMinPaperSizeL"].ToString() != "") { model.mmt_iMinPaperSizeL = int.Parse(sdr["mmt_iMinPaperSizeL"].ToString()); } if (sdr["mmt_iMinPaperSizeW"] != null && sdr["mmt_iMinPaperSizeW"].ToString() != "") { model.mmt_iMinPaperSizeW = int.Parse(sdr["mmt_iMinPaperSizeW"].ToString()); } if (sdr["mmt_cAreaID"] != null && sdr["mmt_cAreaID"].ToString() != "") { model.mmt_cAreaID = new Guid(sdr["mmt_cAreaID"].ToString()); } if (sdr["mmt_iIsPublic"] != null && sdr["mmt_iIsPublic"].ToString() != "") { if ((sdr["mmt_iIsPublic"].ToString() == "1") || (sdr["mmt_iIsPublic"].ToString().ToLower() == "true")) { model.mmt_iIsPublic = true; } else { model.mmt_iIsPublic = false; } } //if (sdr["mmt_cMachineName"] != null && sdr["mmt_cMachineName"].ToString() != "") //{ // model.mmt_cMachineName = sdr["mmt_cMachineName"].ToString(); //} if (sdr["mmt_lActive"] != null && sdr["mmt_lActive"].ToString() != "") { if ((sdr["mmt_lActive"].ToString() == "1") || (sdr["mmt_lActive"].ToString().ToLower() == "true")) { model.mmt_lActive = true; } else { model.mmt_lActive = false; } } list.Add(model); } } return list; } catch (Exception ex) { throw ex; } }
private void lvStopReasonsMain_SelectedIndexChanged(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; if (lvStopReasonsMain.SelectedItems.Count > 0) { if (CheckIsSave()) { ShowDialogSaveData(); } StopReasonMaster_srm_Info srp = lvStopReasonsMain.SelectedItems[0].Tag as StopReasonMaster_srm_Info; mSelectedReasonID = srp.srm_iRecordID; MachineMasterBL machineMaster = new MachineMasterBL(); MachineMaster_mmt_Info cond = new MachineMaster_mmt_Info(); cond.mmt_cMachineType = srp.srm_cMachineType; var vmachines = machineMaster.SearchRecords(cond); IList<MachineStopReasonProfile_msrp_Info> machineStopReasonProfile = _MachineStopReasonBL.GetStopReasonByReasonID(mSelectedReasonID); if (machineStopReasonProfile != null) { m_MachineStopReasonProfile = machineStopReasonProfile.ToList(); } else { m_MachineStopReasonProfile = new List<MachineStopReasonProfile_msrp_Info>(); } List<MachineMaster_mmt_Info> machines = new List<MachineMaster_mmt_Info>(); foreach (MachineMaster_mmt_Info item in vmachines) { machines.Add(item); } List<MachineMaster_mmt_Info> selectedMachines = new List<MachineMaster_mmt_Info>(); List<MachineMaster_mmt_Info> unSelectedMachines = new List<MachineMaster_mmt_Info>(); foreach (MachineStopReasonProfile_msrp_Info item in m_MachineStopReasonProfile) { MachineMaster_mmt_Info obj = machines.Find(s => s.mmt_cMachineID.ToUpper().Trim() == item.msrp_cMachineID.ToUpper().Trim()); if (obj != null) { selectedMachines.Add(obj); } } foreach (MachineMaster_mmt_Info item in machines) { if (!selectedMachines.Contains(item)) unSelectedMachines.Add(item); } FillMachineData(unSelectedMachines, lvUnSelectedMachines2, true); FillMachineData(selectedMachines, lvSelectedMachines2, true); //ClearData(); tsbAdd.Enabled = false; m_SelectedMainObject = srp; } this.Cursor = Cursors.Default; }
private string GetMachineMasterSQL(MachineMaster_mmt_Info model) { StringBuilder strSql = new StringBuilder(); StringBuilder strSql1 = new StringBuilder(); StringBuilder strSql2 = new StringBuilder(); if (model.mmt_cMachineID != null) { strSql1.Append("mmt_cMachineID,"); strSql2.Append("'" + model.mmt_cMachineID + "',"); } if (model.mmt_cLocation != null) { strSql1.Append("mmt_cLocation,"); strSql2.Append("'" + model.mmt_cLocation + "',"); } if (model.mmt_cPressCode != null) { strSql1.Append("mmt_cPressCode,"); strSql2.Append("'" + model.mmt_cPressCode + "',"); } if (model.mmt_cModel != null) { strSql1.Append("mmt_cModel,"); strSql2.Append("'" + model.mmt_cModel + "',"); } if (model.mmt_iMaxPaperSizeL != null) { strSql1.Append("mmt_iMaxPaperSizeL,"); strSql2.Append("" + model.mmt_iMaxPaperSizeL + ","); } if (model.mmt_iMaxPaperSizeW != null) { strSql1.Append("mmt_iMaxPaperSizeW,"); strSql2.Append("" + model.mmt_iMaxPaperSizeW + ","); } if (model.mmt_cMachineType != null) { strSql1.Append("mmt_cMachineType,"); strSql2.Append("'" + model.mmt_cMachineType + "',"); } if (model.mmt_cAddBy != null) { strSql1.Append("mmt_cAddBy,"); strSql2.Append("'" + model.mmt_cAddBy + "',"); } if (model.mmt_dAddDate != null) { strSql1.Append("mmt_dAddDate,"); strSql2.Append("'" + model.mmt_dAddDate.Value.ToString(this._sqlLiteDatetimeFormat) + "',"); } if (model.mmt_cLastBy != null) { strSql1.Append("mmt_cLastBy,"); strSql2.Append("'" + model.mmt_cLastBy + "',"); } if (model.mmt_dLastDate != null) { strSql1.Append("mmt_dLastDate,"); strSql2.Append("'" + model.mmt_dLastDate.Value.ToString(this._sqlLiteDatetimeFormat) + "',"); } if (model.mmt_iMinPaperSizeL != null) { strSql1.Append("mmt_iMinPaperSizeL,"); strSql2.Append("" + model.mmt_iMinPaperSizeL + ","); } if (model.mmt_iMinPaperSizeW != null) { strSql1.Append("mmt_iMinPaperSizeW,"); strSql2.Append("" + model.mmt_iMinPaperSizeW + ","); } if (model.mmt_cAreaID != null) { strSql1.Append("mmt_cAreaID,"); strSql2.Append("'" + model.mmt_cAreaID + "',"); } if (model.mmt_iIsPublic != null) { strSql1.Append("mmt_iIsPublic,"); strSql2.Append("" + (model.mmt_iIsPublic ? 1 : 0) + ","); } if (model.mmt_lActive != null) { strSql1.Append("mmt_lActive,"); strSql2.Append("" + (model.mmt_lActive ? 1 : 0) + ","); } strSql.Append("insert into MachineMaster_mmt("); strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1)); strSql.Append(")"); strSql.Append(" values ("); strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1)); strSql.Append(")"); return strSql.ToString(); }
private void btnRemove_Click(object sender, EventArgs e) { if (lvwMachine.CheckedItems.Count > 0) { List<MachineMaster_mmt_Info> removeList = new List<MachineMaster_mmt_Info>(); foreach (ListViewItem item in lvwMachine.CheckedItems) { MachineMaster_mmt_Info tempInfo = new MachineMaster_mmt_Info(); tempInfo.mmt_cMachineID = item.SubItems[0].Text; removeList.Add(tempInfo); } bool isSuccess = this._areaMasterBL.RemoveArea(removeList); if (isSuccess) { ShowInformationMessage("操作成功!"); GetMachinesList(); } else { ShowErrorMessage("操作失敗!"); } } }
private void BtnSave_Click(object sender, EventArgs e) { try { MachineProperty wmp = this.ppgList.SelectedObject as MachineProperty; if (CheckCanSave() == false) { this.Cursor = Cursors.Default; return; } this.Cursor = Cursors.WaitCursor; ReturnValueInfo rvInfo = null; MachineMaster_mmt_Info machineInfoEntity = new MachineMaster_mmt_Info(); machineInfoEntity.mmt_cMachineID = wmp.mmt_cMachineID; machineInfoEntity.mmt_cMachineName = wmp.mmt_cMachineName; //wmp.cAreaName = machineInfoEntity.cAreaName; machineInfoEntity.mmt_cAreaID = new Guid(wmp.mmt_cAreaID); machineInfoEntity.mmt_cLocation = wmp.mmt_cLocation; machineInfoEntity.mmt_cPressCode = wmp.mmt_cPressCode; machineInfoEntity.mmt_cMachineType = wmp.mmt_cMachineType; machineInfoEntity.mmt_cModel = wmp.mmt_cModel; machineInfoEntity.mmt_iMaxPaperSizeL = wmp.mmt_iMaxPaperSizeL; machineInfoEntity.mmt_iMaxPaperSizeW = wmp.mmt_iMaxPaperSizeW; machineInfoEntity.mmt_iMinPaperSizeL = wmp.mmt_iMinPaperSizeL; machineInfoEntity.mmt_iMinPaperSizeW = wmp.mmt_iMinPaperSizeW; machineInfoEntity.mmt_iIsPublic = (wmp.mmt_iIsPublic == CustEnum.ChineseYesNo.是); machineInfoEntity.mmt_lActive = (wmp.mmt_lActive == CustEnum.ChineseYesNo.是); //wmp.mmt_iIsPublic = (MachineProperty.YesNo)Enum.Parse(typeof(MachineProperty.YesNo), machineInfoEntity.IsPublic); if (this.EditState == Common.DefineConstantValue.EditStateEnum.OE_Insert) { if (_MachineMasterBL.IsExistRecord(machineInfoEntity)) { this.ShowWarningMessage("該機台已存在,請檢查。"); this.Cursor = Cursors.Default; return; } machineInfoEntity.mmt_cAddBy = this.UserInformation.usm_cChaName; machineInfoEntity.mmt_dAddDate = DateTime.Now; machineInfoEntity.mmt_cLastBy = this.UserInformation.usm_cChaName; machineInfoEntity.mmt_dLastDate = DateTime.Now; rvInfo = this._MachineMasterBL.Save(machineInfoEntity, Common.DefineConstantValue.EditStateEnum.OE_Insert); } if (this.EditState == Common.DefineConstantValue.EditStateEnum.OE_Update) { machineInfoEntity.mmt_cLastBy = this.UserInformation.usm_cChaName; machineInfoEntity.mmt_dLastDate = DateTime.Now; rvInfo = this._MachineMasterBL.Save(machineInfoEntity, Common.DefineConstantValue.EditStateEnum.OE_Update); } if (rvInfo.boolValue && !rvInfo.isError) { this.ShowInformationMessage("保存成功。"); mIsChanged = false; } else { this.ShowWarningMessage("保存失敗,異常信息:" + rvInfo.messageText); } this.Cursor = Cursors.Default; } catch (Exception ex) { this.ShowWarningMessage("保存失敗,異常信息:" + ex.Message); } }