コード例 #1
0
ファイル: Dal_TPB_JRLTJ.cs プロジェクト: rcw0125/PCI20200819
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Mod_TPB_JRLTJ model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TPB_JRLTJ set ");
            strSql.Append("C_STL_GRD=:C_STL_GRD,");
            strSql.Append("C_STD_CODE=:C_STD_CODE,");
            strSql.Append("C_SPEC_STR=:C_SPEC_STR,");
            strSql.Append("N_WD=:N_WD,");
            strSql.Append("N_TIME=:N_TIME,");
            strSql.Append("C_REMARK=:C_REMARK,");
            strSql.Append("C_EMP_ID=:C_EMP_ID,");
            strSql.Append("D_MOD_DT=:D_MOD_DT,");
            strSql.Append("C_STA_ID=:C_STA_ID");
            strSql.Append(" where C_ID=:C_ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_STL_GRD",  OracleDbType.Varchar2, 100),
                new OracleParameter(":C_STD_CODE", OracleDbType.Varchar2, 500),
                new OracleParameter(":C_SPEC_STR", OracleDbType.Varchar2, 200),
                new OracleParameter(":N_WD",       OracleDbType.Int16,      5),
                new OracleParameter(":N_TIME",     OracleDbType.Int16,      5),
                new OracleParameter(":C_REMARK",   OracleDbType.Varchar2, 500),
                new OracleParameter(":C_EMP_ID",   OracleDbType.Varchar2, 100),
                new OracleParameter(":D_MOD_DT",   OracleDbType.Date),
                new OracleParameter(":C_STA_ID",   OracleDbType.Varchar2, 100),
                new OracleParameter(":C_ID",       OracleDbType.Varchar2, 100)
            };
            parameters[0].Value = model.C_STL_GRD;
            parameters[1].Value = model.C_STD_CODE;
            parameters[2].Value = model.C_SPEC_STR;
            parameters[3].Value = model.N_WD;
            parameters[4].Value = model.N_TIME;
            parameters[5].Value = model.C_REMARK;
            parameters[6].Value = model.C_EMP_ID;
            parameters[7].Value = model.D_MOD_DT;
            parameters[8].Value = model.C_STA_ID;
            parameters[9].Value = model.C_ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
ファイル: Dal_TPB_JRLTJ.cs プロジェクト: rcw0125/PCI20200819
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Mod_TPB_JRLTJ DataRowToModel(DataRow row)
        {
            Mod_TPB_JRLTJ model = new Mod_TPB_JRLTJ();

            if (row != null)
            {
                if (row["C_ID"] != null)
                {
                    model.C_ID = row["C_ID"].ToString();
                }
                if (row["C_STL_GRD"] != null)
                {
                    model.C_STL_GRD = row["C_STL_GRD"].ToString();
                }
                if (row["C_STD_CODE"] != null)
                {
                    model.C_STD_CODE = row["C_STD_CODE"].ToString();
                }
                if (row["C_SPEC_STR"] != null)
                {
                    model.C_SPEC_STR = row["C_SPEC_STR"].ToString();
                }
                if (row["N_WD"] != null && row["N_WD"].ToString() != "")
                {
                    model.N_WD = decimal.Parse(row["N_WD"].ToString());
                }
                if (row["N_TIME"] != null && row["N_TIME"].ToString() != "")
                {
                    model.N_TIME = decimal.Parse(row["N_TIME"].ToString());
                }
                if (row["C_REMARK"] != null)
                {
                    model.C_REMARK = row["C_REMARK"].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_STA_ID"] != null)
                {
                    model.C_STA_ID = row["C_STA_ID"].ToString();
                }
            }
            return(model);
        }
コード例 #3
0
ファイル: Dal_TPB_JRLTJ.cs プロジェクト: rcw0125/PCI20200819
        /// <summary>
        /// 判断是否存在该数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int SFCF(Mod_TPB_JRLTJ model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(1) FROM TPB_JRLTJ ");
            strSql.Append(" WHERE C_STL_GRD='" + model.C_STL_GRD + "'");
            strSql.Append(" AND C_STD_CODE='" + model.C_STD_CODE + "'");
            strSql.Append(" AND C_STA_ID='" + model.C_STA_ID + "'");
            strSql.Append(" AND C_SPEC_STR LIKE '%" + model.C_SPEC_STR + "%'");
            object obj = DbHelperOra.GetSingle(strSql.ToString());

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
コード例 #4
0
ファイル: Dal_TPB_JRLTJ.cs プロジェクト: rcw0125/PCI20200819
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Mod_TPB_JRLTJ model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TPB_JRLTJ(");
            strSql.Append("C_STL_GRD,C_STD_CODE,C_SPEC_STR,N_WD,N_TIME,C_REMARK,C_EMP_ID,D_MOD_DT,C_STA_ID)");
            strSql.Append(" values (");
            strSql.Append(":C_STL_GRD,:C_STD_CODE,:C_SPEC_STR,:N_WD,:N_TIME,:C_REMARK,:C_EMP_ID,:D_MOD_DT,:C_STA_ID)");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_STL_GRD",  OracleDbType.Varchar2, 100),
                new OracleParameter(":C_SPEC_STR", OracleDbType.Varchar2, 100),
                new OracleParameter(":C_SPEC_STR", OracleDbType.Varchar2, 500),
                new OracleParameter(":N_WD",       OracleDbType.Int16,      5),
                new OracleParameter(":N_TIME",     OracleDbType.Int16,      5),
                new OracleParameter(":C_REMARK",   OracleDbType.Varchar2, 500),
                new OracleParameter(":C_EMP_ID",   OracleDbType.Varchar2, 100),
                new OracleParameter(":D_MOD_DT",   OracleDbType.Date),
                new OracleParameter(":C_STA_ID",   OracleDbType.Varchar2, 100)
            };
            parameters[0].Value = model.C_STL_GRD;
            parameters[1].Value = model.C_STD_CODE;
            parameters[2].Value = model.C_SPEC_STR;
            parameters[3].Value = model.N_WD;
            parameters[4].Value = model.N_TIME;
            parameters[5].Value = model.C_REMARK;
            parameters[6].Value = model.C_EMP_ID;
            parameters[7].Value = model.D_MOD_DT;
            parameters[8].Value = model.C_STA_ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #5
0
ファイル: Dal_TPB_JRLTJ.cs プロジェクト: rcw0125/PCI20200819
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Mod_TPB_JRLTJ GetModel(string C_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select C_ID,C_STL_GRD,C_STD_CODE,C_SPEC_STR,N_WD,N_TIME,C_REMARK,C_EMP_ID,D_MOD_DT,C_STA_ID from TPB_JRLTJ ");
            strSql.Append(" where C_ID=:C_ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_ID", OracleDbType.Varchar2, 100)
            };
            parameters[0].Value = C_ID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
コード例 #6
0
        private void btn_Save_Click(object sender, EventArgs e)
        {
            int[] grdrow = gv_StdMain.GetSelectedRows();
            int[] ggrow  = gv_GG.GetSelectedRows();
            if (grdrow.Count() < 1)
            {
                MessageBox.Show("未选中钢种!");
                return;
            }
            if (ggrow.Count() < 1)
            {
                MessageBox.Show("未选中规格!");
                return;
            }
            if (txt_TIME.Text.Trim() == "" || txt_TIME.Text.Trim() == "0")
            {
                MessageBox.Show("时间不能为0或为空!");
                return;
            }
            if (txt_WD.Text.Trim() == "" || txt_WD.Text.Trim() == "0")
            {
                MessageBox.Show("温度不能为0或为空!");
                return;
            }
            string yczmessage = "";
            string cgmessage  = "";
            string sbmessage  = "";

            foreach (var grditem in grdrow)
            {
                string ggstr = "";
                foreach (var ggitem in ggrow)
                {
                    string gg = gv_GG.GetRowCellValue(ggitem, "C_SPEC").ToString();
                    ggstr += gg + ",";
                }
                ggstr = ggstr.Substring(0, ggstr.Length - 1);
                string        grd           = gv_StdMain.GetRowCellValue(grditem, "C_STL_GRD").ToString();
                string        std           = gv_StdMain.GetRowCellValue(grditem, "C_STD_CODE").ToString();
                Mod_TPB_JRLTJ mod_TPB_JRLTJ = new Mod_TPB_JRLTJ();
                mod_TPB_JRLTJ.C_STL_GRD  = grd;
                mod_TPB_JRLTJ.C_STD_CODE = std;
                mod_TPB_JRLTJ.C_STA_ID   = cbo_GW2.EditValue.ToString();
                mod_TPB_JRLTJ.C_EMP_ID   = RV.UI.UserInfo.userID;
                mod_TPB_JRLTJ.N_WD       = Convert.ToDecimal(txt_WD.Text == ""?"0": txt_WD.Text);
                mod_TPB_JRLTJ.N_TIME     = Convert.ToDecimal(txt_TIME.Text == "" ? "0": txt_TIME.Text);
                string[] ggarr = ggstr.Split(',');
                string   msggg = "";
                foreach (var gg in ggarr)
                {
                    mod_TPB_JRLTJ.C_SPEC_STR = gg;
                    if (bll_TPB_JRLTJ.SFCF(mod_TPB_JRLTJ) > 0)
                    {
                        msggg += gg + ",";
                    }
                }
                if (msggg != "")
                {
                    msggg       = msggg.Substring(0, msggg.Length - 1);
                    yczmessage += grd + "(" + std + "):" + msggg + "\r\n";
                    continue;
                }
                mod_TPB_JRLTJ.C_SPEC_STR = ggstr;
                if (bll_TPB_JRLTJ.Add(mod_TPB_JRLTJ) == true)
                {
                    cgmessage += grd + "(" + std + ") \r\n";
                }
                else
                {
                    sbmessage += grd + "(" + std + ") \r\n";
                }
            }
            if (cgmessage != "")
            {
                cgmessage += "保存成功!\r\n";
            }
            if (yczmessage != "")
            {
                yczmessage += "已存在,保存失败!\r\n";
            }
            if (sbmessage != "")
            {
                sbmessage += "保存异常!";
            }
            MessageBox.Show(cgmessage + yczmessage + sbmessage);
            cbo_GW2.EditValue = cbo_GW1.EditValue;
            QueryJRLTJ();
        }
コード例 #7
0
ファイル: Bll_TPB_JRLTJ.cs プロジェクト: rcw0125/PCI20200819
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Mod_TPB_JRLTJ model)
 {
     return(dal.Update(model));
 }
コード例 #8
0
ファイル: Bll_TPB_JRLTJ.cs プロジェクト: rcw0125/PCI20200819
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Mod_TPB_JRLTJ model)
 {
     return(dal.Add(model));
 }
コード例 #9
0
ファイル: Bll_TPB_JRLTJ.cs プロジェクト: rcw0125/PCI20200819
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return dal.GetList(PageSize,PageIndex,strWhere);
        //}

        #endregion  BasicMethod
        #region  ExtensionMethod
        /// <summary>
        /// 判断是否存在该数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int SFCF(Mod_TPB_JRLTJ model)
        {
            return(dal.SFCF(model));
        }