Esempio n. 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.tb_KuWeiDetail model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_KuWeiDetail set ");
            strSql.Append("RuKuTime=@RuKuTime,");
            strSql.Append("CaoZuoYuan=@CaoZuoYuan");
            strSql.Append(" where HuoJiaHao=@HuoJiaHao and CengHao=@CengHao and LieHao=@LieHao and XuHao=@XuHao ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@RuKuTime",   SqlDbType.NChar, 10),
                new SqlParameter("@CaoZuoYuan", SqlDbType.NChar, 10),
                new SqlParameter("@HuoJiaHao",  SqlDbType.NChar, 10),
                new SqlParameter("@CengHao",    SqlDbType.NChar, 10),
                new SqlParameter("@LieHao",     SqlDbType.NChar, 10),
                new SqlParameter("@XuHao",      SqlDbType.NChar, 10)
            };
            parameters[0].Value = model.RuKuTime;
            parameters[1].Value = model.CaoZuoYuan;
            parameters[2].Value = model.HuoJiaHao;
            parameters[3].Value = model.CengHao;
            parameters[4].Value = model.LieHao;
            parameters[5].Value = model.XuHao;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.tb_KuWeiDetail model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_KuWeiDetail(");
            strSql.Append("HuoJiaHao,CengHao,LieHao,XuHao,RuKuTime,CaoZuoYuan)");
            strSql.Append(" values (");
            strSql.Append("@HuoJiaHao,@CengHao,@LieHao,@XuHao,@RuKuTime,@CaoZuoYuan)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@HuoJiaHao",  SqlDbType.NChar, 10),
                new SqlParameter("@CengHao",    SqlDbType.NChar, 10),
                new SqlParameter("@LieHao",     SqlDbType.NChar, 10),
                new SqlParameter("@XuHao",      SqlDbType.NChar, 10),
                new SqlParameter("@RuKuTime",   SqlDbType.NChar, 10),
                new SqlParameter("@CaoZuoYuan", SqlDbType.NChar, 10)
            };
            parameters[0].Value = model.HuoJiaHao;
            parameters[1].Value = model.CengHao;
            parameters[2].Value = model.LieHao;
            parameters[3].Value = model.XuHao;
            parameters[4].Value = model.RuKuTime;
            parameters[5].Value = model.CaoZuoYuan;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.tb_KuWeiDetail DataRowToModel(DataRow row)
 {
     Maticsoft.Model.tb_KuWeiDetail model = new Maticsoft.Model.tb_KuWeiDetail();
     if (row != null)
     {
         if (row["HuoJiaHao"] != null)
         {
             model.HuoJiaHao = row["HuoJiaHao"].ToString();
         }
         if (row["CengHao"] != null)
         {
             model.CengHao = row["CengHao"].ToString();
         }
         if (row["LieHao"] != null)
         {
             model.LieHao = row["LieHao"].ToString();
         }
         if (row["XuHao"] != null)
         {
             model.XuHao = row["XuHao"].ToString();
         }
         if (row["RuKuTime"] != null)
         {
             model.RuKuTime = row["RuKuTime"].ToString();
         }
         if (row["CaoZuoYuan"] != null)
         {
             model.CaoZuoYuan = row["CaoZuoYuan"].ToString();
         }
     }
     return(model);
 }
Esempio n. 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.tb_KuWeiDetail GetModel(string HuoJiaHao, string CengHao, string LieHao, string XuHao)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 HuoJiaHao,CengHao,LieHao,XuHao,RuKuTime,CaoZuoYuan from tb_KuWeiDetail ");
            strSql.Append(" where HuoJiaHao=@HuoJiaHao and CengHao=@CengHao and LieHao=@LieHao and XuHao=@XuHao ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@HuoJiaHao", SqlDbType.NChar, 10),
                new SqlParameter("@CengHao",   SqlDbType.NChar, 10),
                new SqlParameter("@LieHao",    SqlDbType.NChar, 10),
                new SqlParameter("@XuHao",     SqlDbType.NChar, 10)
            };
            parameters[0].Value = HuoJiaHao;
            parameters[1].Value = CengHao;
            parameters[2].Value = LieHao;
            parameters[3].Value = XuHao;

            Maticsoft.Model.tb_KuWeiDetail model = new Maticsoft.Model.tb_KuWeiDetail();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 5
0
 private void ShowInfo(string HuoJiaHao, string CengHao, string LieHao, string XuHao)
 {
     Maticsoft.BLL.tb_KuWeiDetail   bll   = new Maticsoft.BLL.tb_KuWeiDetail();
     Maticsoft.Model.tb_KuWeiDetail model = bll.GetModel(HuoJiaHao, CengHao, LieHao, XuHao);
     this.lblHuoJiaHao.Text  = model.HuoJiaHao;
     this.lblCengHao.Text    = model.CengHao;
     this.lblLieHao.Text     = model.LieHao;
     this.lblXuHao.Text      = model.XuHao;
     this.lblRuKuTime.Text   = model.RuKuTime;
     this.lblCaoZuoYuan.Text = model.CaoZuoYuan;
 }
Esempio n. 6
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtHuoJiaHao.Text.Trim().Length == 0)
            {
                strErr += "HuoJiaHao不能为空!\\n";
            }
            if (this.txtCengHao.Text.Trim().Length == 0)
            {
                strErr += "CengHao不能为空!\\n";
            }
            if (this.txtLieHao.Text.Trim().Length == 0)
            {
                strErr += "LieHao不能为空!\\n";
            }
            if (this.txtXuHao.Text.Trim().Length == 0)
            {
                strErr += "XuHao不能为空!\\n";
            }
            if (this.txtRuKuTime.Text.Trim().Length == 0)
            {
                strErr += "RuKuTime不能为空!\\n";
            }
            if (this.txtCaoZuoYuan.Text.Trim().Length == 0)
            {
                strErr += "CaoZuoYuan不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string HuoJiaHao  = this.txtHuoJiaHao.Text;
            string CengHao    = this.txtCengHao.Text;
            string LieHao     = this.txtLieHao.Text;
            string XuHao      = this.txtXuHao.Text;
            string RuKuTime   = this.txtRuKuTime.Text;
            string CaoZuoYuan = this.txtCaoZuoYuan.Text;

            Maticsoft.Model.tb_KuWeiDetail model = new Maticsoft.Model.tb_KuWeiDetail();
            model.HuoJiaHao  = HuoJiaHao;
            model.CengHao    = CengHao;
            model.LieHao     = LieHao;
            model.XuHao      = XuHao;
            model.RuKuTime   = RuKuTime;
            model.CaoZuoYuan = CaoZuoYuan;

            Maticsoft.BLL.tb_KuWeiDetail bll = new Maticsoft.BLL.tb_KuWeiDetail();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }