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

            strSql.Append("update Homemadetab set ");
            strSql.Append("Name=@Name,");
            strSql.Append("Photourl=@Photourl,");
            strSql.Append("Comment=@Comment,");
            strSql.Append("Beizhu=@Beizhu,");
            strSql.Append("BY1=@BY1,");
            strSql.Append("BY2=@BY2,");
            strSql.Append("BY3=@BY3,");
            strSql.Append("BY4=@BY4,");
            strSql.Append("BY5=@BY5,");
            strSql.Append("BY6=@BY6,");
            strSql.Append("BY7=@BY7");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Name",     SqlDbType.VarChar,    200),
                new SqlParameter("@Photourl", SqlDbType.VarChar,   4000),
                new SqlParameter("@Comment",  SqlDbType.VarChar,   4000),
                new SqlParameter("@Beizhu",   SqlDbType.VarChar,   4000),
                new SqlParameter("@BY1",      SqlDbType.Decimal,      9),
                new SqlParameter("@BY2",      SqlDbType.Decimal,      9),
                new SqlParameter("@BY3",      SqlDbType.Decimal,      9),
                new SqlParameter("@BY4",      SqlDbType.VarBinary, 4000),
                new SqlParameter("@BY5",      SqlDbType.VarBinary, 4000),
                new SqlParameter("@BY6",      SqlDbType.VarBinary, 4000),
                new SqlParameter("@BY7",      SqlDbType.VarBinary, 4000),
                new SqlParameter("@id",       SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.Name;
            parameters[1].Value  = model.Photourl;
            parameters[2].Value  = model.Comment;
            parameters[3].Value  = model.Beizhu;
            parameters[4].Value  = model.BY1;
            parameters[5].Value  = model.BY2;
            parameters[6].Value  = model.BY3;
            parameters[7].Value  = model.BY4;
            parameters[8].Value  = model.BY5;
            parameters[9].Value  = model.BY6;
            parameters[10].Value = model.BY7;
            parameters[11].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.Homemadetab DataRowToModel(DataRow row)
 {
     Maticsoft.Model.Homemadetab model = new Maticsoft.Model.Homemadetab();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["Name"] != null)
         {
             model.Name = row["Name"].ToString();
         }
         if (row["Photourl"] != null)
         {
             model.Photourl = row["Photourl"].ToString();
         }
         if (row["Comment"] != null)
         {
             model.Comment = row["Comment"].ToString();
         }
         if (row["Beizhu"] != null)
         {
             model.Beizhu = row["Beizhu"].ToString();
         }
         if (row["BY1"] != null && row["BY1"].ToString() != "")
         {
             model.BY1 = decimal.Parse(row["BY1"].ToString());
         }
         if (row["BY2"] != null && row["BY2"].ToString() != "")
         {
             model.BY2 = decimal.Parse(row["BY2"].ToString());
         }
         if (row["BY3"] != null && row["BY3"].ToString() != "")
         {
             model.BY3 = decimal.Parse(row["BY3"].ToString());
         }
         if (row["BY4"] != null && row["BY4"].ToString() != "")
         {
             model.BY4 = (byte[])row["BY4"];
         }
         if (row["BY5"] != null && row["BY5"].ToString() != "")
         {
             model.BY5 = (byte[])row["BY5"];
         }
         if (row["BY6"] != null && row["BY6"].ToString() != "")
         {
             model.BY6 = (byte[])row["BY6"];
         }
         if (row["BY7"] != null && row["BY7"].ToString() != "")
         {
             model.BY7 = (byte[])row["BY7"];
         }
     }
     return(model);
 }
Exemple #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int            id = Convert.ToInt32(Request.QueryString["id"].ToString());
         Model.OrderTab or = ot.GetModel(id);
         Label1.Text = or.OrderNumber;
         if (or.PhotoID1 != 0)
         {
             Model.phototab ph = pt.GetModel(Convert.ToInt32(or.PhotoID1));
             ImageButton1.ImageUrl = ph.Photourl;
         }
         if (or.PhotoID2 != 0)
         {
             Model.phototab ph = pt.GetModel(Convert.ToInt32(or.PhotoID2));
             ImageButton2.ImageUrl = ph.Photourl;
         }
         if (or.PhotoID3 != 0)
         {
             Model.phototab ph = pt.GetModel(Convert.ToInt32(or.PhotoID3));
             ImageButton3.ImageUrl = ph.Photourl;
         }
         if (or.PhotoID4 != 0)
         {
             Model.phototab ph = pt.GetModel(Convert.ToInt32(or.PhotoID4));
             ImageButton4.ImageUrl = ph.Photourl;
         }
         Label3.Text  = or.alllength.ToString();
         Label4.Text  = or.Imperial.ToString();
         Label5.Text  = or.QhWidth.ToString();
         Label6.Text  = or.Beizhuzz;
         Label7.Text  = or.Zengsong;
         Label8.Text  = or.MemberName;
         Label9.Text  = or.MemberPhone;
         Label10.Text = or.MemberPhone1;
         Label11.Text = or.MemberAdd;
         Label12.Text = Convert.ToDateTime(or.validity).ToString("yyyy-MM-dd");
         Label13.Text = or.AllMoney.ToString();
         Label14.Text = or.Deposit.ToString();
         Maticsoft.Model.Homemadetab ho = hot.GetModel(Convert.ToInt32(or.HomemadeID));
         ImageButton5.ImageUrl = ho.Photourl;
         if (or.Zhuangtai2 == 1)
         {
             Label15.Text = "未付全款";
         }
         else if (or.Zhuangtai2 == 2)
         {
             Label15.Text = "已付全款";
         }
         else
         {
             Label15.Text = "状态异常";
         }
     }
 }
Exemple #4
0
 private void ShowInfo(int id)
 {
     Maticsoft.BLL.Homemadetab   bll   = new Maticsoft.BLL.Homemadetab();
     Maticsoft.Model.Homemadetab model = bll.GetModel(id);
     this.lblid.Text       = model.id.ToString();
     this.lblName.Text     = model.Name;
     this.lblPhotourl.Text = model.Photourl;
     this.lblComment.Text  = model.Comment;
     this.lblBeizhu.Text   = model.Beizhu;
     this.lblBY1.Text      = model.BY1.ToString();
     this.lblBY2.Text      = model.BY2.ToString();
     this.lblBY3.Text      = model.BY3.ToString();
     this.lblBY4.Text      = model.BY4.ToString();
     this.lblBY5.Text      = model.BY5.ToString();
     this.lblBY6.Text      = model.BY6.ToString();
     this.lblBY7.Text      = model.BY7.ToString();
 }
Exemple #5
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Maticsoft.Model.Homemadetab model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Homemadetab(");
            strSql.Append("Name,Photourl,Comment,Beizhu,BY1,BY2,BY3,BY4,BY5,BY6,BY7)");
            strSql.Append(" values (");
            strSql.Append("@Name,@Photourl,@Comment,@Beizhu,@BY1,@BY2,@BY3,@BY4,@BY5,@BY6,@BY7)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Name",     SqlDbType.VarChar,    200),
                new SqlParameter("@Photourl", SqlDbType.VarChar,   4000),
                new SqlParameter("@Comment",  SqlDbType.VarChar,   4000),
                new SqlParameter("@Beizhu",   SqlDbType.VarChar,   4000),
                new SqlParameter("@BY1",      SqlDbType.Decimal,      9),
                new SqlParameter("@BY2",      SqlDbType.Decimal,      9),
                new SqlParameter("@BY3",      SqlDbType.Decimal,      9),
                new SqlParameter("@BY4",      SqlDbType.VarBinary, 4000),
                new SqlParameter("@BY5",      SqlDbType.VarBinary, 4000),
                new SqlParameter("@BY6",      SqlDbType.VarBinary, 4000),
                new SqlParameter("@BY7",      SqlDbType.VarBinary, 4000)
            };
            parameters[0].Value  = model.Name;
            parameters[1].Value  = model.Photourl;
            parameters[2].Value  = model.Comment;
            parameters[3].Value  = model.Beizhu;
            parameters[4].Value  = model.BY1;
            parameters[5].Value  = model.BY2;
            parameters[6].Value  = model.BY3;
            parameters[7].Value  = model.BY4;
            parameters[8].Value  = model.BY5;
            parameters[9].Value  = model.BY6;
            parameters[10].Value = model.BY7;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemple #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.Homemadetab GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,Name,Photourl,Comment,Beizhu,BY1,BY2,BY3,BY4,BY5,BY6,BY7 from Homemadetab ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemple #7
0
 Maticsoft.BLL.Homemadetab hot  = new BLL.Homemadetab();  //自制商品
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int            id = Convert.ToInt32(Request.QueryString["id"].ToString());
         Model.OrderTab or = ot.GetModel(id);
         Label1.Text = or.OrderNumber;
         if (or.PhotoID1 != 0)
         {
             Model.phototab ph = pt.GetModel(Convert.ToInt32(or.PhotoID1));
             ImageButton1.ImageUrl = ph.Photourl;
         }
         if (or.PhotoID2 != 0)
         {
             Model.phototab ph = pt.GetModel(Convert.ToInt32(or.PhotoID2));
             ImageButton2.ImageUrl = ph.Photourl;
         }
         if (or.PhotoID3 != 0)
         {
             Model.phototab ph = pt.GetModel(Convert.ToInt32(or.PhotoID3));
             ImageButton3.ImageUrl = ph.Photourl;
         }
         if (or.PhotoID4 != 0)
         {
             Model.phototab ph = pt.GetModel(Convert.ToInt32(or.PhotoID4));
             ImageButton4.ImageUrl = ph.Photourl;
         }
         Label3.Text  = or.alllength.ToString();
         Label4.Text  = or.Imperial.ToString();
         Label5.Text  = or.QhWidth.ToString();
         Label6.Text  = or.Beizhuzz;
         Label7.Text  = or.Zengsong;
         Label8.Text  = or.MemberName;
         Label9.Text  = or.MemberPhone;
         Label10.Text = or.MemberPhone1;
         Label11.Text = or.MemberAdd;
         Label12.Text = Convert.ToDateTime(or.validity).ToString("yyyy-MM-dd");
         Label13.Text = or.AllMoney.ToString();
         Label14.Text = or.Deposit.ToString();
         Label15.Text = or.Beizhuwg;
         Maticsoft.Model.Homemadetab ho = hot.GetModel(Convert.ToInt32(or.HomemadeID));
         ImageButton5.ImageUrl = ho.Photourl;
         if (or.Zhuangtai2 == 1)
         {
             Label23.Text = "未付全款";
         }
         else if (or.Zhuangtai2 == 2)
         {
             Label23.Text = "已付全款";
         }
         else
         {
             Label23.Text = "状态异常";
         }
         DataSet ds = ct.GetList(" OrderNumber like '" + Label1.Text + "'");
         if (ds.Tables[0].Rows.Count > 0)
         {
             for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
             {
                 Model.ContractTab con = ct.GetModel(Convert.ToInt32(ds.Tables[0].Rows[i]["id"]));
                 if (con.By1 == 1)
                 {
                     Label16.Text = con.CommodityID;
                 }
                 else if (con.By1 == 2)
                 {
                     Label17.Text = con.CommodityID;
                 }
                 else if (con.By1 == 3)
                 {
                     Label18.Text = con.CommodityID;
                 }
                 else if (con.By1 == 4)
                 {
                     Label19.Text = con.CommodityID;
                 }
                 else if (con.By1 == 5)
                 {
                     Label20.Text = con.CommodityID;
                 }
                 else if (con.By1 == 6)
                 {
                     Label21.Text = con.CommodityID;
                 }
                 else if (con.By1 == 7)
                 {
                     Label22.Text = con.CommodityID;
                 }
                 else
                 {
                 }
                 if (i == ds.Tables[0].Rows.Count - 1)
                 {
                     if (Label16.Text == "")
                     {
                         Label16.Text = "无";
                     }
                     if (Label17.Text == "")
                     {
                         Label17.Text = "无";
                     }
                     if (Label18.Text == "")
                     {
                         Label18.Text = "无";
                     }
                     if (Label19.Text == "")
                     {
                         Label19.Text = "无";
                     }
                     if (Label20.Text == "")
                     {
                         Label20.Text = "无";
                     }
                     if (Label21.Text == "")
                     {
                         Label21.Text = "无";
                     }
                     if (Label22.Text == "")
                     {
                         Label22.Text = "无";
                     }
                 }
             }
         }
         else
         {
             Label16.Text = "无";
             Label17.Text = "无";
             Label18.Text = "无";
             Label19.Text = "无";
             Label20.Text = "无";
             Label21.Text = "无";
             Label22.Text = "无";
         }
     }
 }
Exemple #8
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtName.Text.Trim().Length == 0)
            {
                strErr += "Name不能为空!\\n";
            }
            if (this.txtPhotourl.Text.Trim().Length == 0)
            {
                strErr += "Photourl不能为空!\\n";
            }
            if (this.txtComment.Text.Trim().Length == 0)
            {
                strErr += "Comment不能为空!\\n";
            }
            if (this.txtBeizhu.Text.Trim().Length == 0)
            {
                strErr += "Beizhu不能为空!\\n";
            }
            if (!PageValidate.IsDecimal(txtBY1.Text))
            {
                strErr += "BY1格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtBY2.Text))
            {
                strErr += "BY2格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtBY3.Text))
            {
                strErr += "BY3格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string  Name     = this.txtName.Text;
            string  Photourl = this.txtPhotourl.Text;
            string  Comment  = this.txtComment.Text;
            string  Beizhu   = this.txtBeizhu.Text;
            decimal BY1      = decimal.Parse(this.txtBY1.Text);
            decimal BY2      = decimal.Parse(this.txtBY2.Text);
            decimal BY3      = decimal.Parse(this.txtBY3.Text);

            byte[] BY4 = new UnicodeEncoding().GetBytes(this.txtBY4.Text);
            byte[] BY5 = new UnicodeEncoding().GetBytes(this.txtBY5.Text);
            byte[] BY6 = new UnicodeEncoding().GetBytes(this.txtBY6.Text);
            byte[] BY7 = new UnicodeEncoding().GetBytes(this.txtBY7.Text);

            Maticsoft.Model.Homemadetab model = new Maticsoft.Model.Homemadetab();
            model.Name     = Name;
            model.Photourl = Photourl;
            model.Comment  = Comment;
            model.Beizhu   = Beizhu;
            model.BY1      = BY1;
            model.BY2      = BY2;
            model.BY3      = BY3;
            model.BY4      = BY4;
            model.BY5      = BY5;
            model.BY6      = BY6;
            model.BY7      = BY7;

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