/// <summary> /// 更新一条数据 /// </summary> public bool Update(Mod_TPB_WASTE_RATIO model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update TPB_WASTE_RATIO set "); strSql.Append("C_STA_ID=:C_STA_ID,"); strSql.Append("N_WGT=:N_WGT,"); strSql.Append("N_TS_WGT=:N_TS_WGT,"); strSql.Append("N_STATUS=:N_STATUS,"); strSql.Append("C_EMP_ID=:C_EMP_ID,"); strSql.Append("D_MOD_DT=:D_MOD_DT,"); strSql.Append("C_REMARK=:C_REMARK,"); strSql.Append("N_FG_WGT=:N_FG_WGT,"); strSql.Append("N_CG_WGT=:N_CG_WGT,"); strSql.Append("C_STA_NAME=:C_STA_NAME"); strSql.Append(" where C_ID=:C_ID "); OracleParameter[] parameters = { new OracleParameter(":C_STA_ID", OracleDbType.Varchar2, 100), new OracleParameter(":N_WGT", OracleDbType.Int16, 3), new OracleParameter(":N_TS_WGT", OracleDbType.Int16, 3), new OracleParameter(":N_STATUS", OracleDbType.Int16, 1), new OracleParameter(":C_EMP_ID", OracleDbType.Varchar2, 100), new OracleParameter(":D_MOD_DT", OracleDbType.Date), new OracleParameter(":C_REMARK", OracleDbType.Varchar2, 500), new OracleParameter(":N_FG_WGT", OracleDbType.Int16, 3), new OracleParameter(":N_CG_WGT", OracleDbType.Int16, 3), new OracleParameter(":C_STA_NAME", OracleDbType.Varchar2, 100), new OracleParameter(":C_ID", OracleDbType.Varchar2, 100) }; parameters[0].Value = model.C_STA_ID; parameters[1].Value = model.N_WGT; parameters[2].Value = model.N_TS_WGT; parameters[3].Value = model.N_STATUS; parameters[4].Value = model.C_EMP_ID; parameters[5].Value = model.D_MOD_DT; parameters[6].Value = model.C_REMARK; parameters[7].Value = model.N_FG_WGT; parameters[8].Value = model.N_CG_WGT; parameters[9].Value = model.C_STA_NAME; parameters[10].Value = model.C_ID; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Mod_TPB_WASTE_RATIO DataRowToModel(DataRow row) { Mod_TPB_WASTE_RATIO model = new Mod_TPB_WASTE_RATIO(); if (row != null) { if (row["C_ID"] != null) { model.C_ID = row["C_ID"].ToString(); } if (row["C_STA_ID"] != null) { model.C_STA_ID = row["C_STA_ID"].ToString(); } if (row["N_WGT"] != null && row["N_WGT"].ToString() != "") { model.N_WGT = decimal.Parse(row["N_WGT"].ToString()); } if (row["N_TS_WGT"] != null && row["N_TS_WGT"].ToString() != "") { model.N_TS_WGT = decimal.Parse(row["N_TS_WGT"].ToString()); } if (row["N_STATUS"] != null && row["N_STATUS"].ToString() != "") { model.N_STATUS = decimal.Parse(row["N_STATUS"].ToString()); } if (row["C_EMP_ID"] != null) { model.C_EMP_ID = row["C_EMP_ID"].ToString(); } if (row["D_MOD_DT"] != null && row["D_MOD_DT"].ToString() != "") { model.D_MOD_DT = DateTime.Parse(row["D_MOD_DT"].ToString()); } if (row["C_REMARK"] != null) { model.C_REMARK = row["C_REMARK"].ToString(); } if (row["N_FG_WGT"] != null && row["N_FG_WGT"].ToString() != "") { model.N_FG_WGT = decimal.Parse(row["N_FG_WGT"].ToString()); } if (row["N_CG_WGT"] != null && row["N_CG_WGT"].ToString() != "") { model.N_CG_WGT = decimal.Parse(row["N_CG_WGT"].ToString()); } if (row["C_STA_NAME"] != null) { model.C_STA_NAME = row["C_STA_NAME"].ToString(); } } return(model); }
private void FrmPB_ZLTSFG_EDIT_Load(object sender, EventArgs e) { strMenuName = RV.UI.UserInfo.menuName; Mod_TPB_WASTE_RATIO mod = bll_TPB_WASTE_RATIO.GetModel(c_id); //wgt = Convert.ToDecimal(mod.N_IRON_RATIO + mod.N_SCRAP_RATIO); commonSub.ImageComboBoxEditBindGW("", cbo_ZL1);//绑定工位 cbo_ZL1.EditValue = mod.C_STA_ID; cbo_ZL1.Enabled = false; txt_CT.Text = mod.N_CG_WGT.ToString(); txt_FG.Text = mod.N_FG_WGT.ToString(); txt_TS.Text = mod.N_TS_WGT.ToString(); txt_ZL.Text = mod.N_WGT.ToString(); txt_Remark.Text = mod.C_REMARK.ToString(); }
private void btn_Save_Click(object sender, EventArgs e) { try { if (txt_ZL.Text == "0" || txt_ZL.Text == "") { txt_ZL.Focus(); MessageBox.Show("每炉重量不能为空或不能等于0,请修改每炉重量!"); return; } if (txt_TS.Text == "0" || txt_TS.Text == "") { txt_TS.Focus(); MessageBox.Show("铁水重量不能为空或不能等于0,请修改每炉重量!"); return; } if (txt_CT.Text == "0" || txt_CT.Text == "") { txt_CT.Focus(); MessageBox.Show("出铁重量不能为空或不能等于0,请修改出铁重量!"); return; } if (Convert.ToDecimal(txt_TS.Text) > Convert.ToDecimal(txt_ZL.Text)) { txt_TS.Focus(); MessageBox.Show("铁水重量不能大于每炉重量,请修改铁水重量!"); return; } if (Convert.ToDecimal(txt_CT.Text) > Convert.ToDecimal(txt_ZL.Text)) { txt_CT.Focus(); MessageBox.Show("出铁重量不能大于每炉重量,请修改出铁重量!"); return; } Mod_TPB_WASTE_RATIO mod = bll_TPB_WASTE_RATIO.GetModel(c_id); mod.N_CG_WGT = Convert.ToDecimal(txt_CT.Text); mod.N_FG_WGT = Convert.ToDecimal(txt_FG.Text); mod.N_TS_WGT = Convert.ToDecimal(txt_TS.Text); mod.N_WGT = Convert.ToDecimal(txt_ZL.Text); mod.C_REMARK = txt_Remark.Text; mod.C_EMP_ID = RV.UI.UserInfo.UserID; mod.D_MOD_DT = RV.UI.ServerTime.timeNow(); bll_TPB_WASTE_RATIO.Update(mod); MessageBox.Show("保存成功!"); Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "修改铁水废钢比例!");//添加操作日志 this.DialogResult = DialogResult.Cancel; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btn_Cancle_Click(object sender, EventArgs e) { try { if (DialogResult.No == MessageBox.Show("是否确认删除?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } int selectedNum = this.gv_Route.SelectedRowsCount; int commitNum = 0; //删除记录数量 int failtNum = 0; //删除失败数量 int[] rownumber = this.gv_Route.GetSelectedRows(); //获取选中行号数组; for (int i = 0; i < rownumber.Length; i++) { int selectedHandle = rownumber[i]; string strID = this.gv_Route.GetRowCellValue(selectedHandle, "C_ID").ToString(); Mod_TPB_WASTE_RATIO model = bll_TPB_WASTE_RATIO.GetModel(strID); model.N_STATUS = 0; model.C_EMP_ID = RV.UI.UserInfo.userID; model.D_MOD_DT = RV.UI.ServerTime.timeNow(); bool update = bll_TPB_WASTE_RATIO.Update(model); if (update) { commitNum = commitNum + 1; } else { failtNum = failtNum + 1; } } MessageBox.Show("选择" + selectedNum.ToString() + "条记录,删除" + commitNum.ToString() + "条记录!"); Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "删除转炉铁水废钢比列信息");//添加操作日志 Query(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Mod_TPB_WASTE_RATIO model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into TPB_WASTE_RATIO("); strSql.Append("C_STA_ID,N_WGT,N_TS_WGT,N_STATUS,C_EMP_ID,C_REMARK,N_FG_WGT,N_CG_WGT,C_STA_NAME)"); strSql.Append(" values ("); strSql.Append(":C_STA_ID,:N_WGT,:N_TS_WGT,:N_STATUS,:C_EMP_ID,:C_REMARK,:N_FG_WGT,:N_CG_WGT,:C_STA_NAME)"); OracleParameter[] parameters = { new OracleParameter(":C_STA_ID", OracleDbType.Varchar2, 100), new OracleParameter(":N_WGT", OracleDbType.Int16, 3), new OracleParameter(":N_TS_WGT", OracleDbType.Int16, 3), new OracleParameter(":N_STATUS", OracleDbType.Int16, 1), new OracleParameter(":C_EMP_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_REMARK", OracleDbType.Varchar2, 500), new OracleParameter(":N_FG_WGT", OracleDbType.Int16, 3), new OracleParameter(":N_CG_WGT", OracleDbType.Int16, 3), new OracleParameter(":C_STA_NAME", OracleDbType.Varchar2, 100) }; parameters[0].Value = model.C_STA_ID; parameters[1].Value = model.N_WGT; parameters[2].Value = model.N_TS_WGT; parameters[3].Value = model.N_STATUS; parameters[4].Value = model.C_EMP_ID; parameters[5].Value = model.C_REMARK; parameters[6].Value = model.N_FG_WGT; parameters[7].Value = model.N_CG_WGT; parameters[8].Value = model.C_STA_NAME; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Mod_TPB_WASTE_RATIO GetModel(string C_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select C_ID,C_STA_ID,N_WGT,N_TS_WGT,N_STATUS,C_EMP_ID,D_MOD_DT,C_REMARK,N_FG_WGT,N_CG_WGT,C_STA_NAME from TPB_WASTE_RATIO "); strSql.Append(" where C_ID=:C_ID "); OracleParameter[] parameters = { new OracleParameter(":C_ID", OracleDbType.Varchar2, 100) }; parameters[0].Value = C_ID; Mod_TPB_WASTE_RATIO model = new Mod_TPB_WASTE_RATIO(); 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_TPB_WASTE_RATIO model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Mod_TPB_WASTE_RATIO model) { return(dal.Add(model)); }
private void btn_Save_Click(object sender, EventArgs e) { try { if (DialogResult.No == MessageBox.Show("是否确认保存?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } if (cbo_ZL1.EditValue.ToString() == "") { cbo_ZL1.Focus(); MessageBox.Show("请选择转炉"); return; } if (txt_ZL.Text == "0" || txt_ZL.Text == "") { txt_ZL.Focus(); MessageBox.Show("每炉重量不能为空或不能等于0,请修改每炉重量!"); return; } if (txt_TS.Text == "0" || txt_TS.Text == "") { txt_TS.Focus(); MessageBox.Show("铁水重量不能为空或不能等于0,请修改每炉重量!"); return; } if (txt_CT.Text == "0" || txt_CT.Text == "") { txt_CT.Focus(); MessageBox.Show("出铁重量不能为空或不能等于0,请修改出铁重量!"); return; } if (Convert.ToDecimal(txt_TS.Text) > Convert.ToDecimal(txt_ZL.Text)) { txt_TS.Focus(); MessageBox.Show("铁水重量不能大于每炉重量,请修改铁水重量!"); return; } if (Convert.ToDecimal(txt_CT.Text) > Convert.ToDecimal(txt_ZL.Text)) { txt_CT.Focus(); MessageBox.Show("出铁重量不能大于每炉重量,请修改出铁重量!"); return; } Mod_TPB_WASTE_RATIO mod_TPB_WASTE_RATIO1 = new Mod_TPB_WASTE_RATIO(); mod_TPB_WASTE_RATIO1.C_EMP_ID = RV.UI.UserInfo.userID; mod_TPB_WASTE_RATIO1.C_STA_NAME = cbo_ZL1.Text; mod_TPB_WASTE_RATIO1.C_STA_ID = cbo_ZL1.EditValue.ToString(); mod_TPB_WASTE_RATIO1.C_REMARK = txt_Remark.Text; mod_TPB_WASTE_RATIO1.N_TS_WGT = Convert.ToDecimal(txt_TS.Text); mod_TPB_WASTE_RATIO1.N_FG_WGT = Convert.ToDecimal(txt_FG.Text); mod_TPB_WASTE_RATIO1.N_CG_WGT = Convert.ToDecimal(txt_CT.Text); mod_TPB_WASTE_RATIO1.N_WGT = Convert.ToDecimal(txt_ZL.Text); System.Collections.Hashtable ht = new System.Collections.Hashtable(); ht.Add("C_STA_ID", mod_TPB_WASTE_RATIO1.C_STA_ID); ht.Add("N_STATUS", 1); if (Common.CheckRepeat.CheckTable("TPB_WASTE_RATIO", ht) > 0) { MessageBox.Show("保存失败!存在该记录!"); return; } else { bll_TPB_WASTE_RATIO.Add(mod_TPB_WASTE_RATIO1); Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "添加转炉铁水废钢比列信息");//添加操作日志 MessageBox.Show("保存成功!"); Query(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }