Exemplo n.º 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Mod_TPB_BXGXMGZ GetModel(string C_STL_GRD, string C_SLAB_SIZE, decimal N_LTH, string C_GZLX)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select C_ID,C_EMP_ID,D_MOD_DT,C_STL_GRD,C_SLAB_SIZE,C_GZLX,N_JSCN,N_LTH,N_TOTAL_CN,C_IS_BXG,C_REMARK from TPB_BXGXMGZ ");
            strSql.Append(" where C_STL_GRD=:C_STL_GRD AND C_SLAB_SIZE=:C_SLAB_SIZE AND  N_LTH=:N_LTH AND C_GZLX=:C_GZLX");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_STL_GRD",   OracleDbType.Varchar2, 100),
                new OracleParameter(":C_SLAB_SIZE", OracleDbType.Varchar2, 100),
                new OracleParameter(":N_LTH",       OracleDbType.Decimal),
                new OracleParameter(":C_GZLX",      OracleDbType.Varchar2, 100)
            };
            parameters[0].Value = C_STL_GRD;
            parameters[1].Value = C_SLAB_SIZE;
            parameters[2].Value = N_LTH;
            parameters[3].Value = C_GZLX;

            Mod_TPB_BXGXMGZ model = new Mod_TPB_BXGXMGZ();
            DataSet         ds    = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Mod_TPB_BXGXMGZ model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TPB_BXGXMGZ set ");
            strSql.Append("C_EMP_ID=:C_EMP_ID,");
            strSql.Append("D_MOD_DT=:D_MOD_DT,");
            strSql.Append("C_STL_GRD=:C_STL_GRD,");
            strSql.Append("C_SLAB_SIZE=:C_SLAB_SIZE,");
            strSql.Append("C_GZLX=:C_GZLX,");
            strSql.Append("N_JSCN=:N_JSCN,");
            strSql.Append("N_LTH=:N_LTH,");
            strSql.Append("N_TOTAL_CN=:N_TOTAL_CN,");
            strSql.Append("C_IS_BXG=:C_IS_BXG,");
            strSql.Append("C_REMARK=:C_REMARK ");
            strSql.Append(" where C_ID=:C_ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_EMP_ID",    OracleDbType.Varchar2, 100),
                new OracleParameter(":D_MOD_DT",    OracleDbType.Date),
                new OracleParameter(":C_STL_GRD",   OracleDbType.Varchar2, 100),
                new OracleParameter(":C_SLAB_SIZE", OracleDbType.Varchar2, 100),
                new OracleParameter(":C_GZLX",      OracleDbType.Varchar2, 100),
                new OracleParameter(":N_JSCN",      OracleDbType.Decimal,    5),
                new OracleParameter(":N_LTH",       OracleDbType.Decimal,    4),
                new OracleParameter(":N_TOTAL_CN",  OracleDbType.Decimal,    4),
                new OracleParameter(":C_IS_BXG",    OracleDbType.Varchar2,  10),
                new OracleParameter(":C_REMARK",    OracleDbType.Varchar2, 200),
                new OracleParameter(":C_ID",        OracleDbType.Varchar2, 100)
            };
            parameters[0].Value  = model.C_EMP_ID;
            parameters[1].Value  = model.D_MOD_DT;
            parameters[2].Value  = model.C_STL_GRD;
            parameters[3].Value  = model.C_SLAB_SIZE;
            parameters[4].Value  = model.C_GZLX;
            parameters[5].Value  = model.N_JSCN;
            parameters[6].Value  = model.N_LTH;
            parameters[7].Value  = model.N_TOTAL_CN;
            parameters[8].Value  = model.C_IS_BXG;
            parameters[9].Value  = model.C_REMARK;
            parameters[10].Value = model.C_ID;

            int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Mod_TPB_BXGXMGZ DataRowToModel(DataRow row)
        {
            Mod_TPB_BXGXMGZ model = new Mod_TPB_BXGXMGZ();

            if (row != null)
            {
                if (row["C_ID"] != null)
                {
                    model.C_ID = row["C_ID"].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_STL_GRD"] != null)
                {
                    model.C_STL_GRD = row["C_STL_GRD"].ToString();
                }
                if (row["C_SLAB_SIZE"] != null)
                {
                    model.C_SLAB_SIZE = row["C_SLAB_SIZE"].ToString();
                }
                if (row["C_GZLX"] != null)
                {
                    model.C_GZLX = row["C_GZLX"].ToString();
                }
                if (row["N_JSCN"] != null && row["N_JSCN"].ToString() != "")
                {
                    model.N_JSCN = decimal.Parse(row["N_JSCN"].ToString());
                }
                if (row["N_LTH"] != null && row["N_LTH"].ToString() != "")
                {
                    model.N_LTH = decimal.Parse(row["N_LTH"].ToString());
                }
                if (row["N_TOTAL_CN"] != null && row["N_TOTAL_CN"].ToString() != "")
                {
                    model.N_TOTAL_CN = decimal.Parse(row["N_TOTAL_CN"].ToString());
                }
                if (row["C_IS_BXG"] != null)
                {
                    model.C_IS_BXG = row["C_IS_BXG"].ToString();
                }
                if (row["C_REMARK"] != null)
                {
                    model.C_REMARK = row["C_REMARK"].ToString();
                }
            }
            return(model);
        }
Exemplo n.º 4
0
 private void btn_Save_Click(object sender, EventArgs e)
 {
     try
     {
         int[] rownumberCX = this.gv_StdMain.GetSelectedRows();//获取产线选中行号数组;
         if (rownumberCX.Count() == 0)
         {
             MessageBox.Show("未选中钢种信息!"); return;
         }
         int    count  = rownumberCX.Length;
         int    scount = 0;
         string str    = "";
         foreach (var item in rownumberCX)
         {
             Mod_TPB_BXGXMGZ mod = new Mod_TPB_BXGXMGZ();
             mod.C_GZLX = cbo_GZ.EditValue.ToString();
             //mod.C_SPEC = cbo_SPEC.EditValue.ToString();
             mod.C_STL_GRD = gv_StdMain.GetRowCellValue(item, "C_STL_GRD").ToString();//钢种
             mod.N_JSCN    = Convert.ToDecimal(txt_JSCN.Text);
             mod.C_EMP_ID  = RV.UI.UserInfo.userID;
             mod.D_MOD_DT  = RV.UI.ServerTime.timeNow();
             #region 检测是否重复添加
             System.Collections.Hashtable ht = new System.Collections.Hashtable();
             ht.Add("C_STL_GRD", mod.C_STL_GRD);
             // ht.Add("C_SPEC", mod.C_SPEC);
             ht.Add("C_GZLX", mod.C_GZLX);
             if (Common.CheckRepeat.CheckTable("TPB_BXGXMGZ", ht) > 0)
             {
                 // str += mod.C_STL_GRD + "(" + mod.C_SPEC + "),";
             }
             else
             {
                 bll.Add(mod);
                 scount += 1;
             }
             #endregion
         }
         if (str.Length > 0)
         {
             MessageBox.Show("共" + count + "条数据,保存成功" + scount + "条," + str.Substring(0, str.Length - 1) + "已存在!");
         }
         else
         {
             MessageBox.Show("共" + count + "条数据,保存成功" + scount + "条");
         }
         QueryGZ();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Mod_TPB_BXGXMGZ model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TPB_BXGXMGZ(");
            strSql.Append("C_EMP_ID,D_MOD_DT,C_STL_GRD,C_SLAB_SIZE,C_GZLX,N_JSCN,N_LTH,N_TOTAL_CN,C_IS_BXG,C_REMARK)");
            strSql.Append(" values (");
            strSql.Append(":C_EMP_ID,:D_MOD_DT,:C_STL_GRD,:C_SLAB_SIZE,:C_GZLX,:N_JSCN,:N_LTH,:N_TOTAL_CN,:C_IS_BXG,:C_REMARK)");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_EMP_ID",    OracleDbType.Varchar2, 100),
                new OracleParameter(":D_MOD_DT",    OracleDbType.Date),
                new OracleParameter(":C_STL_GRD",   OracleDbType.Varchar2, 100),
                new OracleParameter(":C_SLAB_SIZE", OracleDbType.Varchar2, 100),
                new OracleParameter(":C_GZLX",      OracleDbType.Varchar2, 100),
                new OracleParameter(":N_JSCN",      OracleDbType.Decimal,    5),
                new OracleParameter(":N_LTH",       OracleDbType.Decimal,    4),
                new OracleParameter(":N_TOTAL_CN",  OracleDbType.Decimal,    4),
                new OracleParameter(":C_IS_BXG",    OracleDbType.Varchar2,  10),
                new OracleParameter(":C_REMARK",    OracleDbType.Varchar2, 200)
            };
            parameters[0].Value = model.C_EMP_ID;
            parameters[1].Value = model.D_MOD_DT;
            parameters[2].Value = model.C_STL_GRD;
            parameters[3].Value = model.C_SLAB_SIZE;
            parameters[4].Value = model.C_GZLX;
            parameters[5].Value = model.N_JSCN;
            parameters[6].Value = model.N_LTH;
            parameters[7].Value = model.N_TOTAL_CN;
            parameters[8].Value = model.C_IS_BXG;
            parameters[9].Value = model.C_REMARK;
            int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Mod_TPB_BXGXMGZ model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Mod_TPB_BXGXMGZ model)
 {
     return(dal.Add(model));
 }
Exemplo n.º 8
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            try
            {
                int             a   = 1;
                Mod_TPB_BXGXMGZ mod = bll_bxg.GetModel(this.txt_gz.Text, this.txt_dm.Text, Convert.ToDecimal(this.txt_dc.Text), this.icbo_xm.Properties.Items[this.icbo_xm.SelectedIndex].Value.ToString());
                if (mod == null)
                {
                    a   = 0;
                    mod = new Mod_TPB_BXGXMGZ();
                }
                mod.C_GZLX      = this.icbo_xm.Properties.Items[this.icbo_xm.SelectedIndex].Value.ToString();
                mod.C_REMARK    = this.icbo_xm.Properties.Items[this.icbo_xm.SelectedIndex].Description.ToString();
                mod.C_STL_GRD   = this.txt_gz.Text;//钢种
                mod.N_JSCN      = Convert.ToDecimal(this.txt_jscn.Text);
                mod.N_TOTAL_CN  = Convert.ToDecimal(txt_cn.Text);
                mod.C_SLAB_SIZE = this.txt_dm.Text; //断面
                mod.N_LTH       = Convert.ToDecimal(this.txt_dc.Text);
                mod.C_IS_BXG    = "1";              //是否不锈钢
                mod.C_EMP_ID    = RV.UI.UserInfo.userID;
                mod.D_MOD_DT    = RV.UI.ServerTime.timeNow();
                if (a == 0)
                {
                    bll_bxg.Add(mod);
                    Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "添加不锈钢修磨规则:" + mod.C_STL_GRD + "~" + mod.C_SLAB_SIZE + "~" + mod.N_LTH.ToString() + "~" + mod.C_GZLX);//添加操作日志
                    MessageBox.Show("不锈钢修磨规则添加成功!");
                }
                else
                {
                    bll_bxg.Update(mod);
                    Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "修改不锈钢修磨规则:" + mod.C_STL_GRD + "~" + mod.C_SLAB_SIZE + "~" + mod.N_LTH.ToString() + "~" + mod.C_GZLX);//添加操作日志
                    MessageBox.Show("不锈钢修磨规则修改成功!");
                }

                //int[] rownumberCX = this.gridView1.GetSelectedRows();//获取产线选中行号数组;
                //if (rownumberCX.Count() == 0)
                //{
                //    MessageBox.Show("未选中钢种信息!"); return;
                //}
                //int count = rownumberCX.Length;
                //int scount = 0;
                //string str = "";
                //foreach (var item in rownumberCX)
                //{

                //    Mod_TPB_BXGXMGZ mod = new Mod_TPB_BXGXMGZ();
                //    mod.C_GZLX = this.icbo_xm.Properties.Items[this.icbo_xm.SelectedIndex].Value.ToString();
                //    mod.C_REMARK= this.icbo_xm.Properties.Items[this.icbo_xm.SelectedIndex].Description.ToString();
                //    mod.C_STL_GRD = gridView1.GetRowCellValue(item, "C_STL_GRD").ToString();//钢种
                //    mod.N_JSCN = Convert.ToDecimal(txt_cn.Text)/12;
                //    mod.N_TOTAL_CN = Convert.ToDecimal(txt_cn.Text);
                //    mod.C_SLAB_SIZE= gridView1.GetRowCellValue(item, "C_SLAB_SIZE").ToString();//断面
                //    mod.N_LTH = Convert.ToDecimal(gridView1.GetRowCellValue(item, "N_LTH").ToString());
                //    mod.C_IS_BXG= gridView1.GetRowCellValue(item, "C_IS_BXG").ToString();//是否不锈钢
                //    mod.C_EMP_ID = RV.UI.UserInfo.userID;
                //    mod.D_MOD_DT = RV.UI.ServerTime.timeNow();
                //    #region 检测是否重复添加
                //    System.Collections.Hashtable ht = new System.Collections.Hashtable();
                //    ht.Add("C_STL_GRD", mod.C_STL_GRD);
                //    ht.Add("C_SLAB_SIZE", mod.C_SLAB_SIZE);
                //    ht.Add("N_LTH", mod.N_LTH);
                //    ht.Add("C_GZLX", mod.C_GZLX);
                //    if (Common.CheckRepeat.CheckTable("TPB_BXGXMGZ", ht) > 0)
                //    {
                //        str += mod.C_STL_GRD + ",";
                //    }
                //    else
                //    {
                //        if (bll_bxg.Add(mod) == false)
                //        {
                //            str += mod.C_STL_GRD + ",";
                //        }
                //        else
                //        {
                //            scount++;
                //        }
                //    }
                //    #endregion


                //}
                //if (str.Length > 0)
                //{
                //    MessageBox.Show("共" + count + "条数据,保存成功" + scount + "条," + str.Substring(0, str.Length - 1) + "已存在!");
                //}
                //else
                //{
                //    MessageBox.Show("共" + count + "条数据,保存成功" + scount + "条!");

                //}
                btn_Query_Click(null, null);
                btn_QueryGZ_Click(null, null);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }