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

            strSql.Append("update tb_KuCunRecords set ");
            strSql.Append("BianMa=@BianMa,");
            strSql.Append("MingCheng=@MingCheng,");
            strSql.Append("GuiGe=@GuiGe,");
            strSql.Append("XingHao=@XingHao,");
            strSql.Append("HeTongHao=@HeTongHao,");
            strSql.Append("X=@X,");
            strSql.Append("Y=@Y,");
            strSql.Append("Z=@Z,");
            strSql.Append("RuKuTime=@RuKuTime,");
            strSql.Append("ChuKuTime=@ChuKuTime,");
            strSql.Append("CaoZuoYuan=@CaoZuoYuan");
            strSql.Append(" where HuoJiaHao=@HuoJiaHao and CengHao=@CengHao and LieHao=@LieHao ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BianMa",     SqlDbType.NChar, 50),
                new SqlParameter("@MingCheng",  SqlDbType.NChar, 50),
                new SqlParameter("@GuiGe",      SqlDbType.NChar, 50),
                new SqlParameter("@XingHao",    SqlDbType.NChar, 50),
                new SqlParameter("@HeTongHao",  SqlDbType.NChar, 50),
                new SqlParameter("@X",          SqlDbType.NChar, 50),
                new SqlParameter("@Y",          SqlDbType.NChar, 50),
                new SqlParameter("@Z",          SqlDbType.NChar, 50),
                new SqlParameter("@RuKuTime",   SqlDbType.NChar, 50),
                new SqlParameter("@ChuKuTime",  SqlDbType.NChar, 50),
                new SqlParameter("@CaoZuoYuan", SqlDbType.NChar, 50),
                new SqlParameter("@HuoJiaHao",  SqlDbType.NChar, 10),
                new SqlParameter("@CengHao",    SqlDbType.NChar, 10),
                new SqlParameter("@LieHao",     SqlDbType.NChar, 10)
            };
            parameters[0].Value  = model.BianMa;
            parameters[1].Value  = model.MingCheng;
            parameters[2].Value  = model.GuiGe;
            parameters[3].Value  = model.XingHao;
            parameters[4].Value  = model.HeTongHao;
            parameters[5].Value  = model.X;
            parameters[6].Value  = model.Y;
            parameters[7].Value  = model.Z;
            parameters[8].Value  = model.RuKuTime;
            parameters[9].Value  = model.ChuKuTime;
            parameters[10].Value = model.CaoZuoYuan;
            parameters[11].Value = model.HuoJiaHao;
            parameters[12].Value = model.CengHao;
            parameters[13].Value = model.LieHao;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.tb_KuCunRecords GetModel(string HuoJiaHao, string CengHao, string LieHao)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 HuoJiaHao,CengHao,LieHao,BianMa,MingCheng,GuiGe,XingHao,HeTongHao,X,Y,Z,RuKuTime,ChuKuTime,CaoZuoYuan from tb_KuCunRecords ");
            strSql.Append(" where HuoJiaHao=@HuoJiaHao and CengHao=@CengHao and LieHao=@LieHao ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@HuoJiaHao", SqlDbType.NChar, 10),
                new SqlParameter("@CengHao",   SqlDbType.NChar, 10),
                new SqlParameter("@LieHao",    SqlDbType.NChar, 10)
            };
            parameters[0].Value = HuoJiaHao;
            parameters[1].Value = CengHao;
            parameters[2].Value = LieHao;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Example #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.tb_KuCunRecords model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_KuCunRecords(");
            strSql.Append("HuoJiaHao,CengHao,LieHao,BianMa,MingCheng,GuiGe,XingHao,HeTongHao,X,Y,Z,RuKuTime,ChuKuTime,CaoZuoYuan)");
            strSql.Append(" values (");
            strSql.Append("@HuoJiaHao,@CengHao,@LieHao,@BianMa,@MingCheng,@GuiGe,@XingHao,@HeTongHao,@X,@Y,@Z,@RuKuTime,@ChuKuTime,@CaoZuoYuan)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@HuoJiaHao",  SqlDbType.NChar, 10),
                new SqlParameter("@CengHao",    SqlDbType.NChar, 10),
                new SqlParameter("@LieHao",     SqlDbType.NChar, 10),
                new SqlParameter("@BianMa",     SqlDbType.NChar, 50),
                new SqlParameter("@MingCheng",  SqlDbType.NChar, 50),
                new SqlParameter("@GuiGe",      SqlDbType.NChar, 50),
                new SqlParameter("@XingHao",    SqlDbType.NChar, 50),
                new SqlParameter("@HeTongHao",  SqlDbType.NChar, 50),
                new SqlParameter("@X",          SqlDbType.NChar, 50),
                new SqlParameter("@Y",          SqlDbType.NChar, 50),
                new SqlParameter("@Z",          SqlDbType.NChar, 50),
                new SqlParameter("@RuKuTime",   SqlDbType.NChar, 50),
                new SqlParameter("@ChuKuTime",  SqlDbType.NChar, 50),
                new SqlParameter("@CaoZuoYuan", SqlDbType.NChar, 50)
            };
            parameters[0].Value  = model.HuoJiaHao;
            parameters[1].Value  = model.CengHao;
            parameters[2].Value  = model.LieHao;
            parameters[3].Value  = model.BianMa;
            parameters[4].Value  = model.MingCheng;
            parameters[5].Value  = model.GuiGe;
            parameters[6].Value  = model.XingHao;
            parameters[7].Value  = model.HeTongHao;
            parameters[8].Value  = model.X;
            parameters[9].Value  = model.Y;
            parameters[10].Value = model.Z;
            parameters[11].Value = model.RuKuTime;
            parameters[12].Value = model.ChuKuTime;
            parameters[13].Value = model.CaoZuoYuan;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #4
0
 private void ShowInfo(string HuoJiaHao, string CengHao, string LieHao)
 {
     Maticsoft.BLL.tb_KuCunRecords   bll   = new Maticsoft.BLL.tb_KuCunRecords();
     Maticsoft.Model.tb_KuCunRecords model = bll.GetModel(HuoJiaHao, CengHao, LieHao);
     this.lblHuoJiaHao.Text  = model.HuoJiaHao;
     this.lblCengHao.Text    = model.CengHao;
     this.lblLieHao.Text     = model.LieHao;
     this.txtBianMa.Text     = model.BianMa;
     this.txtMingCheng.Text  = model.MingCheng;
     this.txtGuiGe.Text      = model.GuiGe;
     this.txtXingHao.Text    = model.XingHao;
     this.txtHeTongHao.Text  = model.HeTongHao;
     this.txtX.Text          = model.X;
     this.txtY.Text          = model.Y;
     this.txtZ.Text          = model.Z;
     this.txtRuKuTime.Text   = model.RuKuTime;
     this.txtChuKuTime.Text  = model.ChuKuTime;
     this.txtCaoZuoYuan.Text = model.CaoZuoYuan;
 }
Example #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.tb_KuCunRecords DataRowToModel(DataRow row)
 {
     Maticsoft.Model.tb_KuCunRecords model = new Maticsoft.Model.tb_KuCunRecords();
     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["BianMa"] != null)
         {
             model.BianMa = row["BianMa"].ToString();
         }
         if (row["MingCheng"] != null)
         {
             model.MingCheng = row["MingCheng"].ToString();
         }
         if (row["GuiGe"] != null)
         {
             model.GuiGe = row["GuiGe"].ToString();
         }
         if (row["XingHao"] != null)
         {
             model.XingHao = row["XingHao"].ToString();
         }
         if (row["HeTongHao"] != null)
         {
             model.HeTongHao = row["HeTongHao"].ToString();
         }
         if (row["X"] != null)
         {
             model.X = row["X"].ToString();
         }
         if (row["Y"] != null)
         {
             model.Y = row["Y"].ToString();
         }
         if (row["Z"] != null)
         {
             model.Z = row["Z"].ToString();
         }
         if (row["RuKuTime"] != null)
         {
             model.RuKuTime = row["RuKuTime"].ToString();
         }
         if (row["ChuKuTime"] != null)
         {
             model.ChuKuTime = row["ChuKuTime"].ToString();
         }
         if (row["CaoZuoYuan"] != null)
         {
             model.CaoZuoYuan = row["CaoZuoYuan"].ToString();
         }
     }
     return(model);
 }
Example #6
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtBianMa.Text.Trim().Length == 0)
            {
                strErr += "BianMa不能为空!\\n";
            }
            if (this.txtMingCheng.Text.Trim().Length == 0)
            {
                strErr += "MingCheng不能为空!\\n";
            }
            if (this.txtGuiGe.Text.Trim().Length == 0)
            {
                strErr += "GuiGe不能为空!\\n";
            }
            if (this.txtXingHao.Text.Trim().Length == 0)
            {
                strErr += "XingHao不能为空!\\n";
            }
            if (this.txtHeTongHao.Text.Trim().Length == 0)
            {
                strErr += "HeTongHao不能为空!\\n";
            }
            if (this.txtX.Text.Trim().Length == 0)
            {
                strErr += "X不能为空!\\n";
            }
            if (this.txtY.Text.Trim().Length == 0)
            {
                strErr += "Y不能为空!\\n";
            }
            if (this.txtZ.Text.Trim().Length == 0)
            {
                strErr += "Z不能为空!\\n";
            }
            if (this.txtRuKuTime.Text.Trim().Length == 0)
            {
                strErr += "RuKuTime不能为空!\\n";
            }
            if (this.txtChuKuTime.Text.Trim().Length == 0)
            {
                strErr += "ChuKuTime不能为空!\\n";
            }
            if (this.txtCaoZuoYuan.Text.Trim().Length == 0)
            {
                strErr += "CaoZuoYuan不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string HuoJiaHao  = this.lblHuoJiaHao.Text;
            string CengHao    = this.lblCengHao.Text;
            string LieHao     = this.lblLieHao.Text;
            string BianMa     = this.txtBianMa.Text;
            string MingCheng  = this.txtMingCheng.Text;
            string GuiGe      = this.txtGuiGe.Text;
            string XingHao    = this.txtXingHao.Text;
            string HeTongHao  = this.txtHeTongHao.Text;
            string X          = this.txtX.Text;
            string Y          = this.txtY.Text;
            string Z          = this.txtZ.Text;
            string RuKuTime   = this.txtRuKuTime.Text;
            string ChuKuTime  = this.txtChuKuTime.Text;
            string CaoZuoYuan = this.txtCaoZuoYuan.Text;


            Maticsoft.Model.tb_KuCunRecords model = new Maticsoft.Model.tb_KuCunRecords();
            model.HuoJiaHao  = HuoJiaHao;
            model.CengHao    = CengHao;
            model.LieHao     = LieHao;
            model.BianMa     = BianMa;
            model.MingCheng  = MingCheng;
            model.GuiGe      = GuiGe;
            model.XingHao    = XingHao;
            model.HeTongHao  = HeTongHao;
            model.X          = X;
            model.Y          = Y;
            model.Z          = Z;
            model.RuKuTime   = RuKuTime;
            model.ChuKuTime  = ChuKuTime;
            model.CaoZuoYuan = CaoZuoYuan;

            Maticsoft.BLL.tb_KuCunRecords bll = new Maticsoft.BLL.tb_KuCunRecords();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }