public ReturnValueInfo DeleteRecord(QualityProblemMaster_qpm_Info reasonInfo) { try { return this._IQualityProblemMasterDA.DeleteRecord(reasonInfo); } catch (Exception ex) { throw ex; } }
public ProjectQualityCheckAppSetting() { InitializeComponent(); this._IQualityProblemMasterBL = MasterBLLFactory.GetBLL<IQualityProblemMasterBL>(MasterBLLFactory.QualityProblemMaster); this._CurrentQpmInfo = null; this._isChanged = false; this._generalBL = GeneralBLLFactory.GetBLL<IGeneralBL>(GeneralBLLFactory.General); //todo: 需初始化用戶信息 if (base.UserInformation == null) { base.UserInformation = new Model.SysMaster.Sys_UserMaster_usm_Info(); base.UserInformation.usm_cUserLoginID = "sys"; } }
///// <summary> ///// 郵件主檔 ///// </summary> ///// <returns></returns> //public List<MailConfig_mcf_Info> GetMailConfigMaster() //{ // List<MailConfig_mcf_Info> list = new List<MailConfig_mcf_Info>(); // StringBuilder strSql = new StringBuilder(); // strSql.AppendLine("select "); // strSql.AppendLine("mcf_iRecordID,mcf_cMailAspect,mcf_cReciver,mcf_cCC,mcf_cAdd,mcf_dAddDate,mcf_cLast,mcf_dLastDate "); // strSql.AppendLine("from MailConfig_mcf "); // using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString())) // { // while (sdr.Read()) // { // MailConfig_mcf_Info model = new MailConfig_mcf_Info(); // if (sdr["mcf_iRecordID"] != null && sdr["mcf_iRecordID"].ToString() != "") // { // model.mcf_iRecordID = int.Parse(sdr["mcf_iRecordID"].ToString()); // } // if (sdr["mcf_cMailAspect"] != null && sdr["mcf_cMailAspect"].ToString() != "") // { // model.mcf_cMailAspect = sdr["mcf_cMailAspect"].ToString(); // } // if (sdr["mcf_cReciver"] != null && sdr["mcf_cReciver"].ToString() != "") // { // model.mcf_cReciver = sdr["mcf_cReciver"].ToString(); // } // if (sdr["mcf_cCC"] != null && sdr["mcf_cCC"].ToString() != "") // { // model.mcf_cCC = sdr["mcf_cCC"].ToString(); // } // if (sdr["mcf_cAdd"] != null && sdr["mcf_cAdd"].ToString() != "") // { // model.mcf_cAdd = sdr["mcf_cAdd"].ToString(); // } // if (sdr["mcf_dAddDate"] != null && sdr["mcf_dAddDate"].ToString() != "") // { // model.mcf_dAddDate = DateTime.Parse(sdr["mcf_dAddDate"].ToString()); // } // if (sdr["mcf_cLast"] != null && sdr["mcf_cLast"].ToString() != "") // { // model.mcf_cLast = sdr["mcf_cLast"].ToString(); // } // if (sdr["mcf_dLastDate"] != null && sdr["mcf_dLastDate"].ToString() != "") // { // model.mcf_dLastDate = DateTime.Parse(sdr["mcf_dLastDate"].ToString()); // } // list.Add(model); // } // } // return list; //} /// <summary> /// 質量問題主檔 /// </summary> /// <param name="machineType"></param> /// <returns></returns> public List<QualityProblemMaster_qpm_Info> GetQualityProblemMaster(string machineType) { try { List<QualityProblemMaster_qpm_Info> data = new List<QualityProblemMaster_qpm_Info>(); StringBuilder strSql = new StringBuilder(); strSql.AppendLine("select "); strSql.AppendLine("qpm_iRecordID,qpm_cProblemCode,qpm_cProblemName,qpm_cProblemType,qpm_cMachineType,qpm_iPredictedTime,qpm_cSuggestedTechnique,qpm_lIsAtive,qpm_cAdd,qpm_dAddDate,qpm_cLast,qpm_dLastDate "); strSql.AppendLine("from QualityProblemMaster_qpm "); strSql.AppendLine("where qpm_cMachineType='" + machineType.Trim() + "' "); strSql.AppendLine("and qpm_lIsAtive=1"); using (SqlDataReader sdr = DbHelperSQL.ExecuteReader(strSql.ToString())) { while (sdr.Read()) { QualityProblemMaster_qpm_Info model = new QualityProblemMaster_qpm_Info(); if (sdr["qpm_iRecordID"] != null && sdr["qpm_iRecordID"].ToString() != "") { model.qpm_iRecordID = int.Parse(sdr["qpm_iRecordID"].ToString()); } if (sdr["qpm_cProblemCode"] != null && sdr["qpm_cProblemCode"].ToString() != "") { model.qpm_cProblemCode = sdr["qpm_cProblemCode"].ToString(); } if (sdr["qpm_cProblemName"] != null && sdr["qpm_cProblemName"].ToString() != "") { model.qpm_cProblemName = sdr["qpm_cProblemName"].ToString(); } if (sdr["qpm_cProblemType"] != null && sdr["qpm_cProblemType"].ToString() != "") { model.qpm_cProblemType = sdr["qpm_cProblemType"].ToString(); } if (sdr["qpm_cMachineType"] != null && sdr["qpm_cMachineType"].ToString() != "") { model.qpm_cMachineType = sdr["qpm_cMachineType"].ToString(); } if (sdr["qpm_iPredictedTime"] != null && sdr["qpm_iPredictedTime"].ToString() != "") { model.qpm_iPredictedTime = int.Parse(sdr["qpm_iPredictedTime"].ToString()); } if (sdr["qpm_cSuggestedTechnique"] != null && sdr["qpm_cSuggestedTechnique"].ToString() != "") { model.qpm_cSuggestedTechnique = sdr["qpm_cSuggestedTechnique"].ToString(); } if (sdr["qpm_lIsAtive"] != null && sdr["qpm_lIsAtive"].ToString() != "") { if ((sdr["qpm_lIsAtive"].ToString() == "1") || (sdr["qpm_lIsAtive"].ToString().ToLower() == "true")) { model.qpm_lIsAtive = true; } else { model.qpm_lIsAtive = false; } } if (sdr["qpm_cAdd"] != null && sdr["qpm_cAdd"].ToString() != "") { model.qpm_cAdd = sdr["qpm_cAdd"].ToString(); } if (sdr["qpm_dAddDate"] != null && sdr["qpm_dAddDate"].ToString() != "") { model.qpm_dAddDate = DateTime.Parse(sdr["qpm_dAddDate"].ToString()); } if (sdr["qpm_cLast"] != null && sdr["qpm_cLast"].ToString() != "") { model.qpm_cLast = sdr["qpm_cLast"].ToString(); } if (sdr["qpm_dLastDate"] != null && sdr["qpm_dLastDate"].ToString() != "") { model.qpm_dLastDate = DateTime.Parse(sdr["qpm_dLastDate"].ToString()); } data.Add(model); } } return data; } catch (Exception ex) { throw ex; } }
public List<QualityProblemMaster_qpm_Info> SearchRecord(QualityProblemMaster_qpm_Info searchInfo) { try { return this._IQualityProblemMasterDA.SearchRecords(searchInfo); } catch (Exception ex) { throw ex; } }
private object GetQualityProblemMasterSQL(QualityProblemMaster_qpm_Info model) { StringBuilder strSql = new StringBuilder(); StringBuilder strSql1 = new StringBuilder(); StringBuilder strSql2 = new StringBuilder(); strSql1.Append("qpm_iRecordID,"); strSql2.Append("'" + model.qpm_iRecordID + "',"); if (model.qpm_cProblemCode != null) { strSql1.Append("qpm_cProblemCode,"); strSql2.Append("'" + model.qpm_cProblemCode + "',"); } if (model.qpm_cProblemName != null) { strSql1.Append("qpm_cProblemName,"); strSql2.Append("'" + model.qpm_cProblemName + "',"); } if (model.qpm_cProblemType != null) { strSql1.Append("qpm_cProblemType,"); strSql2.Append("'" + model.qpm_cProblemType + "',"); } if (model.qpm_cMachineType != null) { strSql1.Append("qpm_cMachineType,"); strSql2.Append("'" + model.qpm_cMachineType + "',"); } strSql1.Append("qpm_iPredictedTime,"); strSql2.Append("" + model.qpm_iPredictedTime + ","); if (model.qpm_cSuggestedTechnique != null) { strSql1.Append("qpm_cSuggestedTechnique,"); strSql2.Append("'" + model.qpm_cSuggestedTechnique + "',"); } strSql1.Append("qpm_lIsAtive,"); strSql2.Append("" + (model.qpm_lIsAtive ? 1 : 0) + ","); if (model.qpm_cAdd != null) { strSql1.Append("qpm_cAdd,"); strSql2.Append("'" + model.qpm_cAdd + "',"); } if (model.qpm_dAddDate != null) { strSql1.Append("qpm_dAddDate,"); strSql2.Append("'" + model.qpm_dAddDate.ToString(this._sqlLiteDatetimeFormat) + "',"); } if (model.qpm_cLast != null) { strSql1.Append("qpm_cLast,"); strSql2.Append("'" + model.qpm_cLast + "',"); } if (model.qpm_dLastDate != null) { strSql1.Append("qpm_dLastDate,"); strSql2.Append("'" + model.qpm_dLastDate.ToString(this._sqlLiteDatetimeFormat) + "',"); } strSql.Append("insert into QualityProblemMaster_qpm("); 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(); }
public Model.General.ReturnValueInfo UpdateRecord(QualityProblemMaster_qpm_Info infoObject) { throw new NotImplementedException(); }
public List<QualityProblemMaster_qpm_Info> SearchRecords(QualityProblemMaster_qpm_Info searchCondition) { throw new NotImplementedException(); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.ppgQpmInfos.Font = ControlSetting.ListFont; if (this.EditState == Common.DefineConstantValue.EditStateEnum.OE_Insert) { this.TabText = "新增 - " + this.Text; if (base.BaseParam != null) { QualityProblemMaster_qpm_Info qpmSearchInfo = this.BaseParam as QualityProblemMaster_qpm_Info; this._CurrentQpmInfo = qpmSearchInfo; } } else if (this.EditState == Common.DefineConstantValue.EditStateEnum.OE_Update) { this.TabText = "編輯 - " + this.Text; if (base.BaseParam != null) { QualityProblemMaster_qpm_Info qpmSearchInfo = this.BaseParam as QualityProblemMaster_qpm_Info; this._CurrentQpmInfo = this._IQualityProblemMasterBL.SearchRecord(qpmSearchInfo.qpm_iRecordID); } else { this.ShowWarningMessage("没有可用的记录。"); } } else if (this.EditState == Common.DefineConstantValue.EditStateEnum.OE_ReaOnly) { this.TabText = "查看 - " + this.Text; if (base.BaseParam != null) { QualityProblemMaster_qpm_Info qpmSearchInfo = this.BaseParam as QualityProblemMaster_qpm_Info; this._CurrentQpmInfo = this._IQualityProblemMasterBL.SearchRecord(qpmSearchInfo.qpm_iRecordID); } else { this.ShowWarningMessage("没有可用的记录。"); } } InitSysBar(); BindPropertyGrid(); }
void sysToolBar_OnItemSave_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; QualityProblemMaster_qpm_Info qpmInfoSave = new QualityProblemMaster_qpm_Info(); QualityProblemProperty qpmInfoPartial = this.ppgQpmInfos.SelectedObject as QualityProblemProperty; ReturnValueInfo rvInfo = null; if (qpmInfoPartial == null) { this.ShowWarningMessage("保存失敗,獲取鍵入資料有誤。"); this.Cursor = Cursors.Default; return; } if (string.IsNullOrEmpty(qpmInfoPartial.qpm_cProblemCode)) { this.ShowWarningMessage("問題編碼,值不能為空。"); this.Cursor = Cursors.Default; return; } if (this.EditState == Common.DefineConstantValue.EditStateEnum.OE_Insert) { qpmInfoSave.qpm_cAdd = base.UserInformation.usm_cUserLoginID; qpmInfoSave.qpm_dAddDate = DateTime.Now; qpmInfoSave.qpm_cLast = base.UserInformation.usm_cUserLoginID; qpmInfoSave.qpm_dLastDate = DateTime.Now; qpmInfoSave.qpm_cMachineType = this._CurrentQpmInfo.qpm_cMachineType; qpmInfoSave.qpm_cProblemCode = qpmInfoPartial.qpm_cProblemCode; qpmInfoSave.qpm_cProblemName = qpmInfoPartial.qpm_cProblemName; qpmInfoSave.qpm_cProblemType = qpmInfoPartial.qpm_cProblemType; qpmInfoSave.qpm_cSuggestedTechnique = qpmInfoPartial.qpm_cSuggestedTechnique; qpmInfoSave.qpm_iPredictedTime = qpmInfoPartial.qpm_iPredictedTime; qpmInfoSave.qpm_lIsAtive = qpmInfoPartial.IsActiveChiness == QualityProblemProperty.YesNo.是; rvInfo = this._IQualityProblemMasterBL.InsertRecord(qpmInfoSave); } else if (this.EditState == Common.DefineConstantValue.EditStateEnum.OE_Update) { qpmInfoSave.qpm_cAdd = this._CurrentQpmInfo.qpm_cAdd; qpmInfoSave.qpm_dAddDate = this._CurrentQpmInfo.qpm_dAddDate; qpmInfoSave.qpm_cLast = base.UserInformation.usm_cUserLoginID; qpmInfoSave.qpm_dLastDate = DateTime.Now; qpmInfoSave.qpm_iRecordID = this._CurrentQpmInfo.qpm_iRecordID; qpmInfoSave.qpm_cMachineType = this._CurrentQpmInfo.qpm_cMachineType; qpmInfoSave.qpm_cProblemCode = qpmInfoPartial.qpm_cProblemCode; qpmInfoSave.qpm_cProblemName = qpmInfoPartial.qpm_cProblemName; qpmInfoSave.qpm_cProblemType = qpmInfoPartial.qpm_cProblemType; qpmInfoSave.qpm_cSuggestedTechnique = qpmInfoPartial.qpm_cSuggestedTechnique; qpmInfoSave.qpm_iPredictedTime = qpmInfoPartial.qpm_iPredictedTime; qpmInfoSave.qpm_lIsAtive = qpmInfoPartial.IsActiveChiness == QualityProblemProperty.YesNo.是; rvInfo = this._IQualityProblemMasterBL.UpdateRecord(qpmInfoSave); } if (rvInfo.boolValue && !rvInfo.isError) { this.ShowInformationMessage("保存成功。"); if (this.EditState == Common.DefineConstantValue.EditStateEnum.OE_Insert) { this.sysToolBar.BtnSave_IsEnabled = false; } } else { this.ShowWarningMessage("保存失敗,異常信息:" + rvInfo.messageText); } this.Cursor = Cursors.Default; }
ReturnValueInfo DeleteRecord(QualityProblemMaster_qpm_Info qualityInfo) { ReturnValueInfo rvInfo = new ReturnValueInfo(); try { if (qualityInfo == null) { rvInfo.messageText = "条件为空。"; rvInfo.isError = true; return rvInfo; } using (MainDBDataContext db = new MainDBDataContext()) { QualityProblemMaster_qpm qpmInfo = db.QualityProblemMaster_qpm.FirstOrDefault(x => x.qpm_iRecordID == qualityInfo.qpm_iRecordID); if (qpmInfo == null) { rvInfo.isError = true; rvInfo.messageText = "没有历史记录。"; return rvInfo; } db.QualityProblemMaster_qpm.DeleteOnSubmit(qpmInfo); db.SubmitChanges(); rvInfo.boolValue = true; } } catch (Exception ex) { rvInfo.messageText = ex.Message; rvInfo.isError = true; } return rvInfo; }
public ReturnValueInfo UpdateRecord(QualityProblemMaster_qpm_Info qualityInfo) { ReturnValueInfo rvInfo = new ReturnValueInfo(); try { if (qualityInfo == null) { rvInfo.messageText = "条件为空。"; rvInfo.isError = true; return rvInfo; } using (MainDBDataContext db = new MainDBDataContext()) { QualityProblemMaster_qpm srmInfo = db.QualityProblemMaster_qpm.FirstOrDefault(x => x.qpm_iRecordID == qualityInfo.qpm_iRecordID); if (srmInfo != null) { srmInfo.qpm_cLast = qualityInfo.qpm_cLast; srmInfo.qpm_cMachineType = qualityInfo.qpm_cMachineType; srmInfo.qpm_cProblemCode = qualityInfo.qpm_cProblemCode; srmInfo.qpm_cProblemName = qualityInfo.qpm_cProblemName; srmInfo.qpm_cProblemType = qualityInfo.qpm_cProblemType; srmInfo.qpm_cSuggestedTechnique = qualityInfo.qpm_cSuggestedTechnique; srmInfo.qpm_dLastDate = qualityInfo.qpm_dLastDate; srmInfo.qpm_iPredictedTime = qualityInfo.qpm_iPredictedTime; srmInfo.qpm_iRecordID = qualityInfo.qpm_iRecordID; srmInfo.qpm_lIsAtive = qualityInfo.qpm_lIsAtive; db.SubmitChanges(); rvInfo.boolValue = true; } else { rvInfo.messageText = "无合适条件的记录。"; rvInfo.isError = true; return rvInfo; } } } catch (Exception ex) { rvInfo.messageText = ex.Message; rvInfo.isError = true; } return rvInfo; }
public List<QualityProblemMaster_qpm_Info> SearchRecords(QualityProblemMaster_qpm_Info searchInfo) { List<QualityProblemMaster_qpm_Info> listReturn = new List<QualityProblemMaster_qpm_Info>(); try { QualityProblemMaster_qpm_Info qpmSearchInfo = searchInfo as QualityProblemMaster_qpm_Info; StringBuilder sbSQL = new StringBuilder(); sbSQL.AppendLine("SELECT TOP " + Common.DefineConstantValue.ListRecordMaxCount.ToString()); sbSQL.AppendLine("cmt_cRemark as qpm_cProblemTypeName,*"); sbSQL.AppendLine("FROM dbo.QualityProblemMaster_qpm"); sbSQL.AppendLine("LEFT JOIN CodeMaster_cmt"); sbSQL.AppendLine("ON cmt_cKey1='" + Common.DefineConstantValue.CodeMasterDefine.KEY1_TYPEVALUE + "' and cmt_cKey2='" + Common.DefineConstantValue.CodeMasterDefine.KEY2_QTYTYPE + "' and cmt_cValue=qpm_cProblemType"); //sbSQL.AppendLine("WHERE 1=1"); string strSQL = sbSQL.ToString(); if (qpmSearchInfo != null) { #region WhereSQL StringBuilder sbWhere = new StringBuilder(); sbWhere.AppendLine("where [qpm_lIsAtive] = 1 "); if (!string.IsNullOrEmpty(qpmSearchInfo.qpm_cProblemCode)) { sbWhere.AppendLine("AND [qpm_cProblemCode] ='" + qpmSearchInfo.qpm_cProblemCode + "'"); } if (!string.IsNullOrEmpty(qpmSearchInfo.qpm_cProblemName)) { sbWhere.AppendLine("AND [qpm_cProblemName] ='" + qpmSearchInfo.qpm_cProblemName + "' "); } if (!string.IsNullOrEmpty(qpmSearchInfo.qpm_cProblemType)) { sbWhere.AppendLine("AND [qpm_cProblemType] ='" + qpmSearchInfo.qpm_cProblemType + "' "); } if (!string.IsNullOrEmpty(qpmSearchInfo.qpm_cMachineType)) { sbWhere.AppendLine("AND [qpm_cMachineType] ='" + qpmSearchInfo.qpm_cMachineType + "' "); } if (!string.IsNullOrEmpty(qpmSearchInfo.qpm_cSuggestedTechnique)) { sbWhere.AppendLine("AND [qpm_cMachineType] LIKE'%" + qpmSearchInfo.qpm_cSuggestedTechnique + "%' "); } if (qpmSearchInfo.qpm_iPredictedTime > 0) { sbWhere.AppendLine("AND [qpm_iPredictedTime] =" + qpmSearchInfo.qpm_iPredictedTime + " "); } if (!string.IsNullOrEmpty(sbWhere.ToString())) { strSQL += sbWhere.ToString(); } #endregion } IEnumerable<QualityProblemMaster_qpm_Info> infos = null; using (MainDBDataContext db = new MainDBDataContext()) { infos = db.ExecuteQuery<QualityProblemMaster_qpm_Info>(strSQL, new object[] { }); if (infos != null) { listReturn = infos.ToList(); } } } catch (Exception ex) { throw ex; } return listReturn; }
public ReturnValueInfo InsertRecord(QualityProblemMaster_qpm_Info qualityInfo) { ReturnValueInfo rvInfo = new ReturnValueInfo(); try { if (qualityInfo == null) { rvInfo.messageText = "条件为空。"; rvInfo.isError = true; return rvInfo; } using (MainDBDataContext db = new MainDBDataContext()) { QualityProblemMaster_qpm qpmInfo = Common.General.CopyObjectValue<QualityProblemMaster_qpm_Info, QualityProblemMaster_qpm>(qualityInfo); QualityProblemMaster_qpm_Info srmLast = GetRecord_Last(qpmInfo.qpm_cMachineType); if (qpmInfo == null) { rvInfo.isError = true; rvInfo.messageText = "实体转换失败。"; } db.QualityProblemMaster_qpm.InsertOnSubmit(qpmInfo); db.SubmitChanges(); rvInfo.boolValue = true; } } catch (Exception ex) { rvInfo.messageText = ex.Message; rvInfo.isError = true; } return rvInfo; }
/// <summary> /// 獲取品檢問題解決問題內容 /// </summary> /// <returns></returns> private List<ComboboxDataInfo> GetQCMasterSettlement() { List<ComboboxDataInfo> infoList = new List<ComboboxDataInfo>(); try { IQualityProblemMasterDA da = SQLiteDAFacotry.GetDAL<IQualityProblemMasterDA>(SQLiteDAFacotry.QualityProblemMaster); QualityProblemMaster_qpm_Info qpmInfo = new QualityProblemMaster_qpm_Info() { qpm_lIsAtive = true }; ; Dictionary<string, object> dicParam = new Dictionary<string, object>(); dicParam.Add("qpm_lIsAtive", qpmInfo.qpm_lIsAtive); List<QualityProblemMaster_qpm_Info> listQCMaster = da.GetEntities<QualityProblemMaster_qpm_Info>(dicParam).ToList(); if (listQCMaster != null && listQCMaster.Count > 0) { foreach (QualityProblemMaster_qpm_Info qcmItem in listQCMaster) { ComboboxDataInfo info = new ComboboxDataInfo(); info.DisplayMember = qcmItem.qpm_cSuggestedTechnique; info.ValueMember = qcmItem.qpm_iRecordID.ToString(); infoList.Add(info); } } } catch (Exception Ex) { throw Ex; } return infoList; }