//添加 protected void btnSave_Click(object sender, EventArgs e) { Mod_TMC_TECH_CONSULT mod = new Mod_TMC_TECH_CONSULT(); string C_ID = Guid.NewGuid().ToString(); mod.C_ID = C_ID; mod.C_QUEST_ID = dropQuest.SelectedValue; mod.C_CUST_NAME = txtCust.Value; mod.C_CUST_CODE = ltlCustNo.Text; mod.C_STL_GRD = txt_STL_GRD.Value; mod.C_USE_DESC = txtUseDesc.Value; mod.C_REMARK = txtRemark.Value; mod.C_EMP_ID = ltlUserID.Text; mod.C_EMP_NAME = ltlUserName.Text; if (tmc_tech_consult.Add(mod)) { DataTable dt = tmc_question_dept.GetQuestion_Dept(dropQuest.SelectedValue, "").Tables[0]; if (dt.Rows.Count > 0) { Mod_TMC_TECH_CONSULT_RESULT mod2 = new Mod_TMC_TECH_CONSULT_RESULT(); for (int i = 0; i < dt.Rows.Count; i++) { mod2.C_TECH_CONSULT_ID = C_ID; mod2.C_DEPT = dt.Rows[i]["C_DEPT_ID"].ToString(); tmc_tech_consult_result.Add(mod2); } } Response.Write("<script>alert('提交成功');window.close();window.opener.location.reload('MyConsult.aspx');</script>"); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Mod_TMC_TECH_CONSULT_RESULT model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into TMC_TECH_CONSULT_RESULT("); strSql.Append("C_TECH_CONSULT_ID,C_DEPT,C_EMP_ID,D_PLAN_DT,D_FINISH_DT,C_REAL_TIME,C_RESULT,C_LEAVE_Q,C_REMARK,N_CUST_EVAL,D_CUST_EVAL_DT,N_XG_EVAL,C_XG_EVAL_EMP,D_XG_EVAL_DT)"); strSql.Append(" values ("); strSql.Append(":C_TECH_CONSULT_ID,:C_DEPT,:C_EMP_ID,:D_PLAN_DT,:D_FINISH_DT,:C_REAL_TIME,:C_RESULT,:C_LEAVE_Q,:C_REMARK,:N_CUST_EVAL,:D_CUST_EVAL_DT,:N_XG_EVAL,:C_XG_EVAL_EMP,:D_XG_EVAL_DT)"); OracleParameter[] parameters = { new OracleParameter(":C_TECH_CONSULT_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_DEPT", OracleDbType.Varchar2, 100), new OracleParameter(":C_EMP_ID", OracleDbType.Varchar2, 100), new OracleParameter(":D_PLAN_DT", OracleDbType.Date), new OracleParameter(":D_FINISH_DT", OracleDbType.Date), new OracleParameter(":C_REAL_TIME", OracleDbType.Varchar2, 300), new OracleParameter(":C_RESULT", OracleDbType.Varchar2, 300), new OracleParameter(":C_LEAVE_Q", OracleDbType.Varchar2, 300), new OracleParameter(":C_REMARK", OracleDbType.Varchar2, 300), new OracleParameter(":N_CUST_EVAL", OracleDbType.Decimal, 2), new OracleParameter(":D_CUST_EVAL_DT", OracleDbType.Date), new OracleParameter(":N_XG_EVAL", OracleDbType.Decimal, 2), new OracleParameter(":C_XG_EVAL_EMP", OracleDbType.Varchar2, 100), new OracleParameter(":D_XG_EVAL_DT", OracleDbType.Date) }; parameters[0].Value = model.C_TECH_CONSULT_ID; parameters[1].Value = model.C_DEPT; parameters[2].Value = model.C_EMP_ID; parameters[3].Value = model.D_PLAN_DT; parameters[4].Value = model.D_FINISH_DT; parameters[5].Value = model.C_REAL_TIME; parameters[6].Value = model.C_RESULT; parameters[7].Value = model.C_LEAVE_Q; parameters[8].Value = model.C_REMARK; parameters[9].Value = model.N_CUST_EVAL; parameters[10].Value = model.D_CUST_EVAL_DT; parameters[11].Value = model.N_XG_EVAL; parameters[12].Value = model.C_XG_EVAL_EMP; parameters[13].Value = model.D_XG_EVAL_DT; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { Mod_TMC_TECH_CONSULT_RESULT mod = tmc_tech_consult_result.GetModel(ltlQuestID.Text); if (mod != null) { mod.D_PLAN_DT = Convert.ToDateTime(Start.Value); mod.D_FINISH_DT = Convert.ToDateTime(End.Value); mod.C_EMP_ID = ltlEmpID.Text; mod.C_REAL_TIME = txtTIMECONTENT.Value; mod.C_RESULT = txtRESULTCONTENT.Value; mod.C_LEAVE_Q = txtQUESTCONTENT.Value; if (tmc_tech_consult_result.Update(mod)) { WebMsg.MessageBox("提交成功", "Consult_List.aspx"); } } }
/// <summary> /// 得到一个对象实体 /// </summary> public Mod_TMC_TECH_CONSULT_RESULT GetModel(string C_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select C_ID,C_TECH_CONSULT_ID,C_DEPT,C_EMP_ID,D_PLAN_DT,D_FINISH_DT,C_REAL_TIME,C_RESULT,C_LEAVE_Q,C_REMARK,N_CUST_EVAL,D_CUST_EVAL_DT,N_XG_EVAL,C_XG_EVAL_EMP,D_XG_EVAL_DT from TMC_TECH_CONSULT_RESULT "); strSql.Append(" where C_ID=:C_ID "); OracleParameter[] parameters = { new OracleParameter(":C_ID", OracleDbType.Varchar2, 100) }; parameters[0].Value = C_ID; Mod_TMC_TECH_CONSULT_RESULT model = new Mod_TMC_TECH_CONSULT_RESULT(); DataSet ds = DbHelperOra.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Mod_TMC_TECH_CONSULT_RESULT model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update TMC_TECH_CONSULT_RESULT set "); strSql.Append("C_TECH_CONSULT_ID=:C_TECH_CONSULT_ID,"); strSql.Append("C_DEPT=:C_DEPT,"); strSql.Append("C_EMP_ID=:C_EMP_ID,"); strSql.Append("D_PLAN_DT=:D_PLAN_DT,"); strSql.Append("D_FINISH_DT=:D_FINISH_DT,"); strSql.Append("C_REAL_TIME=:C_REAL_TIME,"); strSql.Append("C_RESULT=:C_RESULT,"); strSql.Append("C_LEAVE_Q=:C_LEAVE_Q,"); strSql.Append("C_REMARK=:C_REMARK,"); strSql.Append("N_CUST_EVAL=:N_CUST_EVAL,"); strSql.Append("D_CUST_EVAL_DT=:D_CUST_EVAL_DT,"); strSql.Append("N_XG_EVAL=:N_XG_EVAL,"); strSql.Append("C_XG_EVAL_EMP=:C_XG_EVAL_EMP,"); strSql.Append("D_XG_EVAL_DT=:D_XG_EVAL_DT"); strSql.Append(" where C_ID=:C_ID "); OracleParameter[] parameters = { new OracleParameter(":C_TECH_CONSULT_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_DEPT", OracleDbType.Varchar2, 100), new OracleParameter(":C_EMP_ID", OracleDbType.Varchar2, 100), new OracleParameter(":D_PLAN_DT", OracleDbType.Date), new OracleParameter(":D_FINISH_DT", OracleDbType.Date), new OracleParameter(":C_REAL_TIME", OracleDbType.Varchar2, 300), new OracleParameter(":C_RESULT", OracleDbType.Varchar2, 300), new OracleParameter(":C_LEAVE_Q", OracleDbType.Varchar2, 300), new OracleParameter(":C_REMARK", OracleDbType.Varchar2, 300), new OracleParameter(":N_CUST_EVAL", OracleDbType.Decimal, 2), new OracleParameter(":D_CUST_EVAL_DT", OracleDbType.Date), new OracleParameter(":N_XG_EVAL", OracleDbType.Decimal, 2), new OracleParameter(":C_XG_EVAL_EMP", OracleDbType.Varchar2, 100), new OracleParameter(":D_XG_EVAL_DT", OracleDbType.Date), new OracleParameter(":C_ID", OracleDbType.Varchar2, 100) }; parameters[0].Value = model.C_TECH_CONSULT_ID; parameters[1].Value = model.C_DEPT; parameters[2].Value = model.C_EMP_ID; parameters[3].Value = model.D_PLAN_DT; parameters[4].Value = model.D_FINISH_DT; parameters[5].Value = model.C_REAL_TIME; parameters[6].Value = model.C_RESULT; parameters[7].Value = model.C_LEAVE_Q; parameters[8].Value = model.C_REMARK; parameters[9].Value = model.N_CUST_EVAL; parameters[10].Value = model.D_CUST_EVAL_DT; parameters[11].Value = model.N_XG_EVAL; parameters[12].Value = model.C_XG_EVAL_EMP; parameters[13].Value = model.D_XG_EVAL_DT; parameters[14].Value = model.C_ID; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Mod_TMC_TECH_CONSULT_RESULT DataRowToModel(DataRow row) { Mod_TMC_TECH_CONSULT_RESULT model = new Mod_TMC_TECH_CONSULT_RESULT(); if (row != null) { if (row["C_ID"] != null) { model.C_ID = row["C_ID"].ToString(); } if (row["C_TECH_CONSULT_ID"] != null) { model.C_TECH_CONSULT_ID = row["C_TECH_CONSULT_ID"].ToString(); } if (row["C_DEPT"] != null) { model.C_DEPT = row["C_DEPT"].ToString(); } if (row["C_EMP_ID"] != null) { model.C_EMP_ID = row["C_EMP_ID"].ToString(); } if (row["D_PLAN_DT"] != null && row["D_PLAN_DT"].ToString() != "") { model.D_PLAN_DT = DateTime.Parse(row["D_PLAN_DT"].ToString()); } if (row["D_FINISH_DT"] != null && row["D_FINISH_DT"].ToString() != "") { model.D_FINISH_DT = DateTime.Parse(row["D_FINISH_DT"].ToString()); } if (row["C_REAL_TIME"] != null) { model.C_REAL_TIME = row["C_REAL_TIME"].ToString(); } if (row["C_RESULT"] != null) { model.C_RESULT = row["C_RESULT"].ToString(); } if (row["C_LEAVE_Q"] != null) { model.C_LEAVE_Q = row["C_LEAVE_Q"].ToString(); } if (row["C_REMARK"] != null) { model.C_REMARK = row["C_REMARK"].ToString(); } if (row["N_CUST_EVAL"] != null && row["N_CUST_EVAL"].ToString() != "") { model.N_CUST_EVAL = decimal.Parse(row["N_CUST_EVAL"].ToString()); } if (row["D_CUST_EVAL_DT"] != null && row["D_CUST_EVAL_DT"].ToString() != "") { model.D_CUST_EVAL_DT = DateTime.Parse(row["D_CUST_EVAL_DT"].ToString()); } if (row["N_XG_EVAL"] != null && row["N_XG_EVAL"].ToString() != "") { model.N_XG_EVAL = decimal.Parse(row["N_XG_EVAL"].ToString()); } if (row["C_XG_EVAL_EMP"] != null) { model.C_XG_EVAL_EMP = row["C_XG_EVAL_EMP"].ToString(); } if (row["D_XG_EVAL_DT"] != null && row["D_XG_EVAL_DT"].ToString() != "") { model.D_XG_EVAL_DT = DateTime.Parse(row["D_XG_EVAL_DT"].ToString()); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Mod_TMC_TECH_CONSULT_RESULT model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Mod_TMC_TECH_CONSULT_RESULT model) { return(dal.Add(model)); }