/// <summary> /// 将页面值塞入到实体中 /// </summary> private QCScoreType_DataEntity SetEntity() { string messagestr = ""; if (this.txttypename.Text.Trim() == "") { messagestr += "请填写项目名称!"; } if (this.txttypeinstruction.Text.Trim() == "") { messagestr += "请填写项目说明!"; } if (this.cmbtypecategory.SelectedIndex == -1) { messagestr += "请选择项目类型!"; } if (messagestr != "") { m_app.CustomMessageBox.MessageShow(messagestr); return(null); } QCScoreType_DataEntity scoreType = new QCScoreType_DataEntity(); scoreType.Typename = this.txttypename.Text; scoreType.Typeinstruction = this.txttypeinstruction.Text; scoreType.Typecategory = this.cmbtypecategory.SelectedIndex; scoreType.Typeorder = (int)this.txttypeorder.Value; scoreType.Typememo = this.txttypememo.Text; return(scoreType); }
private void btnSave_Click(object sender, EventArgs e) { QCScoreType_DataEntity socretypeentity = SetEntity(); if (socretypeentity == null) { return; } string edittype = ""; //表示为新增 if (m_ScoreType == null) { edittype = "0"; } else { edittype = "1"; socretypeentity.Typecode = m_ScoreType.Typecode; } SqlManger m_sqlmanger = new SqlManger(m_app); m_sqlmanger.EditQCTypeScore(edittype, socretypeentity); m_app.CustomMessageBox.MessageShow("保存成功!"); ISRefresh = true; this.Close(); }
/// <summary> /// 将实体中值填写到页面中 /// </summary> /// <param name="scoreType"></param> private void BinPageByEntity(QCScoreType_DataEntity scoreType) { if (scoreType != null) { this.txttypename.Text = scoreType.Typename; this.txttypeinstruction.Text = scoreType.Typeinstruction; this.cmbtypecategory.SelectedIndex = scoreType.Typecategory; this.txttypeorder.Value = scoreType.Typeorder; this.txttypememo.Text = scoreType.Typememo; } }
/// <summary> /// 大项目代码实体赋值 /// </summary> /// <param name="dataRow"></param> /// <returns></returns> private QCScoreType_DataEntity FillQCTypeValue2Entity(DataRow dataRow) { QCScoreType_DataEntity scoreType = null; if (dataRow != null) { scoreType = new QCScoreType_DataEntity(); scoreType.Typecode = dataRow["TypeCode"].ToString(); scoreType.Typename = dataRow["TypeName"].ToString(); scoreType.Typeinstruction = dataRow["TypeInstruction"].ToString(); scoreType.Typecategory = int.Parse(dataRow["TypeCategory"].ToString()); scoreType.Typeorder = int.Parse(dataRow["TypeOrder"].ToString()); scoreType.Typememo = dataRow["TypeMemo"].ToString(); } return(scoreType); }
/// <summary> /// 评分大项操作方法 /// </summary> /// <param name="editType">操作类型 0:新增 1:修改 2:删除</param> /// <param name="qcscortype">评分大项对应实体</param> public void EditQCTypeScore(string editType, QCScoreType_DataEntity qcscortype) { SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("@TypeName", SqlDbType.VarChar, 40), new SqlParameter("@TypeInstruction", SqlDbType.VarChar, 60), new SqlParameter("@TypeCategory", SqlDbType.Int, 1), new SqlParameter("@TypeOrder", SqlDbType.Int, 4), new SqlParameter("@TypeMemo", SqlDbType.VarChar, 60), new SqlParameter("@TypeStatus", SqlDbType.Int, 1), new SqlParameter("@TypeCode", SqlDbType.VarChar, 4) }; sqlParams[0].Value = qcscortype.Typename; sqlParams[1].Value = qcscortype.Typeinstruction; sqlParams[2].Value = qcscortype.Typecategory; sqlParams[3].Value = qcscortype.Typeorder; sqlParams[4].Value = qcscortype.Typememo; sqlParams[5].Value = Convert.ToInt32(editType); sqlParams[6].Value = qcscortype.Typecode; m_app.SqlHelper.ExecuteNoneQuery("usp_QCTypeScore", sqlParams, CommandType.StoredProcedure); }
private void simpleButton1_Click(object sender, EventArgs e) { m_scoretype = null; BindDataSource(); }