private void btnAdd_Click(object sender, EventArgs e) { QCScoreItem_DataEntity socreItementity = SetEntity(); if (socreItementity == null) { return; } string edittype = ""; //表示为新增 if (m_scoreitem == null) { edittype = "0"; } else { edittype = "1"; socreItementity.Itemcode = m_scoreitem.Itemcode; } SqlManger m_sqlmanger = new SqlManger(m_app); m_sqlmanger.EditQCItemScore(edittype, socreItementity); m_app.CustomMessageBox.MessageShow("保存成功!"); ISRefresh = true; this.Close(); }
/// <summary> /// 将实体中值填写到页面中 /// </summary> /// <param name="scoreType"></param> private void BinPageByEntity(QCScoreItem_DataEntity scoreItem) { if (scoreItem != null) { this.txtname.Text = scoreItem.Itemname; this.txtInstruction.Text = scoreItem.Iteminstruction; this.spinDefaultScore.Value = scoreItem.Itemdefaultscore; this.spinStandardScore.Value = scoreItem.Itemstandardscore; this.cmbcategory.SelectedIndex = scoreItem.Itemcategory; this.spinDefaultTarget.Value = scoreItem.Itemdefaulttarget; this.spinTargetStandard.Value = scoreItem.Itemtargetstandard; this.spinScoreStandard.Value = scoreItem.Itemscorestandard; this.spinOrder.Value = scoreItem.Itemorder; this.lookUpEditorType.CodeValue = scoreItem.Typecode; this.txtmemo.Text = scoreItem.Itemmemo; } }
/// <summary> /// 将页面值塞入到实体中 /// </summary> private QCScoreItem_DataEntity SetEntity() { string messagestr = ""; if (this.txtname.Text.Trim() == "") { messagestr += "请填写项目名称!"; } if (this.lookUpEditorType.CodeValue == "") { messagestr += "请选择对应大项!"; } if (this.cmbcategory.SelectedIndex == -1) { messagestr += "请选择项目类型!"; } if (messagestr != "") { m_app.CustomMessageBox.MessageShow(messagestr); return(null); } QCScoreItem_DataEntity scoreItem = new QCScoreItem_DataEntity(); //scoreItem.Itemcode = dataRow["ItemCode"].ToString(); scoreItem.Itemname = this.txtname.Text.Trim(); scoreItem.Iteminstruction = this.txtInstruction.Text.Trim(); scoreItem.Itemdefaultscore = (int)this.spinDefaultScore.Value; scoreItem.Itemstandardscore = (int)this.spinStandardScore.Value; scoreItem.Itemcategory = (int)this.cmbcategory.SelectedIndex; scoreItem.Itemdefaulttarget = (int)this.spinDefaultTarget.Value; scoreItem.Itemtargetstandard = (int)this.spinTargetStandard.Value; scoreItem.Itemscorestandard = (int)this.spinScoreStandard.Value; scoreItem.Itemorder = (int)this.spinOrder.Value; scoreItem.Typecode = this.lookUpEditorType.CodeValue; scoreItem.Itemmemo = this.txtmemo.Text; return(scoreItem); }
/// <summary> /// xiao项目代码实体赋值 /// </summary> /// <param name="dataRow"></param> /// <returns></returns> private QCScoreItem_DataEntity FillQCTypeValue2Entity(DataRow dataRow) { QCScoreItem_DataEntity scoreItem = null; if (dataRow != null) { scoreItem = new QCScoreItem_DataEntity(); scoreItem.Itemcode = dataRow["ItemCode"].ToString(); scoreItem.Itemname = dataRow["ItemName"].ToString(); scoreItem.Iteminstruction = dataRow["ItemInstruction"].ToString(); scoreItem.Itemdefaultscore = int.Parse(dataRow["ItemDefaultScore"].ToString()); scoreItem.Itemstandardscore = int.Parse(dataRow["ItemStandardScore"].ToString()); scoreItem.Itemcategory = int.Parse(dataRow["ItemCategory"].ToString()); scoreItem.Itemdefaulttarget = Convert.ToInt32(dataRow["ItemDefaultTarget"].ToString()); scoreItem.Itemtargetstandard = Convert.ToInt32(dataRow["ItemTargetStandard"].ToString()); scoreItem.Itemscorestandard = Convert.ToInt32(dataRow["ItemScoreStandard"].ToString()); scoreItem.Itemorder = int.Parse(dataRow["ItemOrder"].ToString()); scoreItem.Typecode = dataRow["TypeCode"].ToString(); scoreItem.Itemmemo = dataRow["ItemMemo"].ToString(); } return(scoreItem); }