Exemple #1
0
        private void bind()
        {
            Maticsoft.BLL.Product probll = new Maticsoft.BLL.Product();
            int index = int.Parse(Request.QueryString["ProID"].ToString());

            Maticsoft.Model.Product     promodel  = probll.GetModel(index);
            Maticsoft.BLL.ProductType   typebll   = new Maticsoft.BLL.ProductType();
            Maticsoft.Model.ProductType typemodel = typebll.GetModel(int.Parse(promodel.ProTypeID.ToString()));
            Maticsoft.BLL.ProductXing   xinbll    = new Maticsoft.BLL.ProductXing();
            Maticsoft.Model.ProductXing xinmodel  = xinbll.GetModel(int.Parse(promodel.ProXingID.ToString()));
            lblchutime.Text   = Convert.ToDateTime(promodel.Prochutime.ToString()).ToString("yyyy-MM-dd");
            lblstarttime.Text = Convert.ToDateTime(promodel.Fatime.ToString()).ToString("yyyy-MM-dd");
            lbltitle.Text     = promodel.ProName;
            lbltype.Text      = typemodel.ProTypeTitle;
            lblxinghao.Text   = xinmodel.ProXingTitle;
            Image1.ImageUrl   = promodel.ImageURL;
            txtcontent.Text   = promodel.Procontent;
            if (promodel.Toujian == 1)
            {
                toujian.Visible = false;
            }
            else
            {
                toujian.Visible = true;
            }
        }
Exemple #2
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtProTypeTitle.Text.Trim().Length == 0)
            {
                strErr += "ProTypeTitle不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int    ProTypeID    = int.Parse(this.lblProTypeID.Text);
            string ProTypeTitle = this.txtProTypeTitle.Text;


            Maticsoft.Model.ProductType model = new Maticsoft.Model.ProductType();
            model.ProTypeID    = ProTypeID;
            model.ProTypeTitle = ProTypeTitle;

            Maticsoft.BLL.ProductType bll = new Maticsoft.BLL.ProductType();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Exemple #3
0
 private void ShowInfo(int ProTypeID)
 {
     Maticsoft.BLL.ProductType   bll   = new Maticsoft.BLL.ProductType();
     Maticsoft.Model.ProductType model = bll.GetModel(ProTypeID);
     this.lblProTypeID.Text    = model.ProTypeID.ToString();
     this.txtProTypeTitle.Text = model.ProTypeTitle;
 }
Exemple #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.ProductType model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ProductType set ");
            strSql.Append("ProTypeTitle=@ProTypeTitle");
            strSql.Append(" where ProTypeID=@ProTypeID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ProTypeID",    SqlDbType.Int,     4),
                new SqlParameter("@ProTypeTitle", SqlDbType.VarChar, 200)
            };
            parameters[0].Value = model.ProTypeID;
            parameters[1].Value = model.ProTypeTitle;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #5
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Maticsoft.Model.ProductType model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ProductType(");
            strSql.Append("ProTypeTitle)");
            strSql.Append(" values (");
            strSql.Append("@ProTypeTitle)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ProTypeTitle", SqlDbType.VarChar, 200)
            };
            parameters[0].Value = model.ProTypeTitle;

            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.ProductType GetModel(int ProTypeID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ProTypeID,ProTypeTitle from ProductType ");
            strSql.Append(" where ProTypeID=@ProTypeID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ProTypeID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ProTypeID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ProTypeID"].ToString() != "")
                {
                    model.ProTypeID = int.Parse(ds.Tables[0].Rows[0]["ProTypeID"].ToString());
                }
                model.ProTypeTitle = ds.Tables[0].Rows[0]["ProTypeTitle"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemple #7
0
 protected void datapro_ItemDataBound(object sender, DataListItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
     {
         Maticsoft.BLL.Product pronll = new Maticsoft.BLL.Product();
         int proid = int.Parse(datapro.DataKeys[e.Item.ItemIndex].ToString());
         Maticsoft.Model.Product   promodel = pronll.GetModel(proid);
         Maticsoft.BLL.ProductType typebll  = new Maticsoft.BLL.ProductType();
         int typeid = int.Parse(promodel.ProTypeID.ToString());
         Maticsoft.Model.ProductType typemodel = typebll.GetModel(typeid);
         ((Label)e.Item.FindControl("lbltype")).Text = typemodel.ProTypeTitle;
     }
 }
Exemple #8
0
 protected void btntype_Click1(object sender, EventArgs e)
 {
     Maticsoft.BLL.ProductType   typebll   = new Maticsoft.BLL.ProductType();
     Maticsoft.Model.ProductType typemodel = new Maticsoft.Model.ProductType();
     if (txtaddtype.Text.Trim() == "")
     {
         lblxinghao.Text = "请填写产品类型";
         return;
     }
     typemodel.ProTypeTitle = txtaddtype.Text.Trim();
     lblxinghao.Text        = "";
     typebll.Add(typemodel);
     txtaddtype.Text = string.Empty;
     lblxinghao.Text = "产品类型提交成功";
 }
Exemple #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString["ProID"] != null)
         {
             if (Request.QueryString["ProID"].ToString() != "")
             {
                 int proid = int.Parse(Request.QueryString["ProID"].ToString());
                 Maticsoft.BLL.Product       probll    = new Maticsoft.BLL.Product();
                 Maticsoft.Model.Product     promodel  = probll.GetModel(proid);
                 Maticsoft.BLL.ProductType   typebll   = new Maticsoft.BLL.ProductType();
                 Maticsoft.Model.ProductType typemodel = typebll.GetModel(int.Parse(promodel.ProTypeID.ToString()));
                 Maticsoft.BLL.ProductXing   xingbll   = new Maticsoft.BLL.ProductXing();
                 Maticsoft.Model.ProductXing xingmodel = xingbll.GetModel(int.Parse(promodel.ProXingID.ToString()));
                 lblFatime.Text = Convert.ToDateTime(promodel.Fatime.ToString()).ToString("yyyy-MM-dd");
                 int hitnum = 0;
                 if (promodel.HitNum != null)
                 {
                     promodel.HitNum = promodel.HitNum + 1;
                     probll.Update(promodel);
                     lblHitNum.Text = promodel.HitNum.ToString();
                 }
                 else
                 {
                     promodel.HitNum = 1;
                     probll.Update(promodel);
                     lblHitNum.Text = promodel.HitNum.ToString();
                 }
                 lblProcontent.Text   = promodel.Procontent;
                 lblProName.Text      = promodel.ProName;
                 lblProName1.Text     = promodel.ProName;
                 lblProTypeTitle.Text = typemodel.ProTypeTitle;
                 lblProXingTitle.Text = xingmodel.ProXingTitle;
                 ImgImageURL.ImageUrl = promodel.ImageURL;
             }
             else
             {
                 Response.Redirect("product.aspx");
             }
         }
         else
         {
             Response.Redirect("product.aspx");
         }
     }
 }
Exemple #10
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtProTypeTitle.Text.Trim().Length == 0)
            {
                strErr += "ProTypeTitle不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string ProTypeTitle = this.txtProTypeTitle.Text;

            Maticsoft.Model.ProductType model = new Maticsoft.Model.ProductType();
            model.ProTypeTitle = ProTypeTitle;

            Maticsoft.BLL.ProductType bll = new Maticsoft.BLL.ProductType();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Exemple #11
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public long Add(Maticsoft.Model.ProductType model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ProductType(");
            strSql.Append("ParentID,Code,Name,Level,Enabled,Status,Remark,Value0,Value1,Value2,Value3,Value4,Value5,Value6,Value7,Value8,Value9,CreateUser,CreateDate,UpdateUser,UpdateDate)");
            strSql.Append(" values (");
            strSql.Append("@ParentID,@Code,@Name,@Level,@Enabled,@Status,@Remark,@Value0,@Value1,@Value2,@Value3,@Value4,@Value5,@Value6,@Value7,@Value8,@Value9,@CreateUser,@CreateDate,@UpdateUser,@UpdateDate)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ParentID",   SqlDbType.BigInt,     8),
                new SqlParameter("@Code",       SqlDbType.NVarChar,  50),
                new SqlParameter("@Name",       SqlDbType.NVarChar,  50),
                new SqlParameter("@Level",      SqlDbType.Int,        4),
                new SqlParameter("@Enabled",    SqlDbType.Bit,        1),
                new SqlParameter("@Status",     SqlDbType.Int,        4),
                new SqlParameter("@Remark",     SqlDbType.NVarChar),
                new SqlParameter("@Value0",     SqlDbType.NVarChar),
                new SqlParameter("@Value1",     SqlDbType.NVarChar),
                new SqlParameter("@Value2",     SqlDbType.NVarChar),
                new SqlParameter("@Value3",     SqlDbType.NVarChar),
                new SqlParameter("@Value4",     SqlDbType.NVarChar),
                new SqlParameter("@Value5",     SqlDbType.NVarChar),
                new SqlParameter("@Value6",     SqlDbType.NVarChar),
                new SqlParameter("@Value7",     SqlDbType.NVarChar),
                new SqlParameter("@Value8",     SqlDbType.NVarChar),
                new SqlParameter("@Value9",     SqlDbType.NVarChar),
                new SqlParameter("@CreateUser", SqlDbType.NVarChar,  50),
                new SqlParameter("@CreateDate", SqlDbType.DateTime),
                new SqlParameter("@UpdateUser", SqlDbType.NVarChar,  50),
                new SqlParameter("@UpdateDate", SqlDbType.DateTime)
            };
            parameters[0].Value  = model.ParentID;
            parameters[1].Value  = model.Code;
            parameters[2].Value  = model.Name;
            parameters[3].Value  = model.Level;
            parameters[4].Value  = model.Enabled;
            parameters[5].Value  = model.Status;
            parameters[6].Value  = model.Remark;
            parameters[7].Value  = model.Value0;
            parameters[8].Value  = model.Value1;
            parameters[9].Value  = model.Value2;
            parameters[10].Value = model.Value3;
            parameters[11].Value = model.Value4;
            parameters[12].Value = model.Value5;
            parameters[13].Value = model.Value6;
            parameters[14].Value = model.Value7;
            parameters[15].Value = model.Value8;
            parameters[16].Value = model.Value9;
            parameters[17].Value = model.CreateUser;
            parameters[18].Value = model.CreateDate;
            parameters[19].Value = model.UpdateUser;
            parameters[20].Value = model.UpdateDate;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt64(obj));
            }
        }
Exemple #12
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.ProductType GetModel(string name)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,ParentID,Code,Name,Level,Enabled,Status,Remark,Value0,Value1,Value2,Value3,Value4,Value5,Value6,Value7,Value8,Value9,CreateUser,CreateDate,UpdateUser,UpdateDate from ProductType ");
            strSql.Append(" where Name=@name");
            SqlParameter[] parameters =
            {
                new SqlParameter("@name", SqlDbType.NVarChar)
            };
            parameters[0].Value = name;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ID"] != null && ds.Tables[0].Rows[0]["ID"].ToString() != "")
                {
                    model.ID = long.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ParentID"] != null && ds.Tables[0].Rows[0]["ParentID"].ToString() != "")
                {
                    model.ParentID = long.Parse(ds.Tables[0].Rows[0]["ParentID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Code"] != null && ds.Tables[0].Rows[0]["Code"].ToString() != "")
                {
                    model.Code = ds.Tables[0].Rows[0]["Code"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Name"] != null && ds.Tables[0].Rows[0]["Name"].ToString() != "")
                {
                    model.Name = ds.Tables[0].Rows[0]["Name"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Level"] != null && ds.Tables[0].Rows[0]["Level"].ToString() != "")
                {
                    model.Level = int.Parse(ds.Tables[0].Rows[0]["Level"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Enabled"] != null && ds.Tables[0].Rows[0]["Enabled"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["Enabled"].ToString() == "1") || (ds.Tables[0].Rows[0]["Enabled"].ToString().ToLower() == "true"))
                    {
                        model.Enabled = true;
                    }
                    else
                    {
                        model.Enabled = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["Status"] != null && ds.Tables[0].Rows[0]["Status"].ToString() != "")
                {
                    model.Status = int.Parse(ds.Tables[0].Rows[0]["Status"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Remark"] != null && ds.Tables[0].Rows[0]["Remark"].ToString() != "")
                {
                    model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Value0"] != null && ds.Tables[0].Rows[0]["Value0"].ToString() != "")
                {
                    model.Value0 = ds.Tables[0].Rows[0]["Value0"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Value1"] != null && ds.Tables[0].Rows[0]["Value1"].ToString() != "")
                {
                    model.Value1 = ds.Tables[0].Rows[0]["Value1"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Value2"] != null && ds.Tables[0].Rows[0]["Value2"].ToString() != "")
                {
                    model.Value2 = ds.Tables[0].Rows[0]["Value2"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Value3"] != null && ds.Tables[0].Rows[0]["Value3"].ToString() != "")
                {
                    model.Value3 = ds.Tables[0].Rows[0]["Value3"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Value4"] != null && ds.Tables[0].Rows[0]["Value4"].ToString() != "")
                {
                    model.Value4 = ds.Tables[0].Rows[0]["Value4"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Value5"] != null && ds.Tables[0].Rows[0]["Value5"].ToString() != "")
                {
                    model.Value5 = ds.Tables[0].Rows[0]["Value5"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Value6"] != null && ds.Tables[0].Rows[0]["Value6"].ToString() != "")
                {
                    model.Value6 = ds.Tables[0].Rows[0]["Value6"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Value7"] != null && ds.Tables[0].Rows[0]["Value7"].ToString() != "")
                {
                    model.Value7 = ds.Tables[0].Rows[0]["Value7"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Value8"] != null && ds.Tables[0].Rows[0]["Value8"].ToString() != "")
                {
                    model.Value8 = ds.Tables[0].Rows[0]["Value8"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Value9"] != null && ds.Tables[0].Rows[0]["Value9"].ToString() != "")
                {
                    model.Value9 = ds.Tables[0].Rows[0]["Value9"].ToString();
                }
                if (ds.Tables[0].Rows[0]["CreateUser"] != null && ds.Tables[0].Rows[0]["CreateUser"].ToString() != "")
                {
                    model.CreateUser = ds.Tables[0].Rows[0]["CreateUser"].ToString();
                }
                if (ds.Tables[0].Rows[0]["CreateDate"] != null && ds.Tables[0].Rows[0]["CreateDate"].ToString() != "")
                {
                    model.CreateDate = DateTime.Parse(ds.Tables[0].Rows[0]["CreateDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["UpdateUser"] != null && ds.Tables[0].Rows[0]["UpdateUser"].ToString() != "")
                {
                    model.UpdateUser = ds.Tables[0].Rows[0]["UpdateUser"].ToString();
                }
                if (ds.Tables[0].Rows[0]["UpdateDate"] != null && ds.Tables[0].Rows[0]["UpdateDate"].ToString() != "")
                {
                    model.UpdateDate = DateTime.Parse(ds.Tables[0].Rows[0]["UpdateDate"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemple #13
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.ProductType model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ProductType set ");
            strSql.Append("ParentID=@ParentID,");
            strSql.Append("Code=@Code,");
            strSql.Append("Name=@Name,");
            strSql.Append("Level=@Level,");
            strSql.Append("Enabled=@Enabled,");
            strSql.Append("Status=@Status,");
            strSql.Append("Remark=@Remark,");
            strSql.Append("Value0=@Value0,");
            strSql.Append("Value1=@Value1,");
            strSql.Append("Value2=@Value2,");
            strSql.Append("Value3=@Value3,");
            strSql.Append("Value4=@Value4,");
            strSql.Append("Value5=@Value5,");
            strSql.Append("Value6=@Value6,");
            strSql.Append("Value7=@Value7,");
            strSql.Append("Value8=@Value8,");
            strSql.Append("Value9=@Value9,");
            strSql.Append("CreateUser=@CreateUser,");
            strSql.Append("CreateDate=@CreateDate,");
            strSql.Append("UpdateUser=@UpdateUser,");
            strSql.Append("UpdateDate=@UpdateDate");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ParentID",   SqlDbType.BigInt,     8),
                new SqlParameter("@Code",       SqlDbType.NVarChar,  50),
                new SqlParameter("@Name",       SqlDbType.NVarChar,  50),
                new SqlParameter("@Level",      SqlDbType.Int,        4),
                new SqlParameter("@Enabled",    SqlDbType.Bit,        1),
                new SqlParameter("@Status",     SqlDbType.Int,        4),
                new SqlParameter("@Remark",     SqlDbType.NVarChar),
                new SqlParameter("@Value0",     SqlDbType.NVarChar),
                new SqlParameter("@Value1",     SqlDbType.NVarChar),
                new SqlParameter("@Value2",     SqlDbType.NVarChar),
                new SqlParameter("@Value3",     SqlDbType.NVarChar),
                new SqlParameter("@Value4",     SqlDbType.NVarChar),
                new SqlParameter("@Value5",     SqlDbType.NVarChar),
                new SqlParameter("@Value6",     SqlDbType.NVarChar),
                new SqlParameter("@Value7",     SqlDbType.NVarChar),
                new SqlParameter("@Value8",     SqlDbType.NVarChar),
                new SqlParameter("@Value9",     SqlDbType.NVarChar),
                new SqlParameter("@CreateUser", SqlDbType.NVarChar,  50),
                new SqlParameter("@CreateDate", SqlDbType.DateTime),
                new SqlParameter("@UpdateUser", SqlDbType.NVarChar,  50),
                new SqlParameter("@UpdateDate", SqlDbType.DateTime),
                new SqlParameter("@ID",         SqlDbType.BigInt, 8)
            };
            parameters[0].Value  = model.ParentID;
            parameters[1].Value  = model.Code;
            parameters[2].Value  = model.Name;
            parameters[3].Value  = model.Level;
            parameters[4].Value  = model.Enabled;
            parameters[5].Value  = model.Status;
            parameters[6].Value  = model.Remark;
            parameters[7].Value  = model.Value0;
            parameters[8].Value  = model.Value1;
            parameters[9].Value  = model.Value2;
            parameters[10].Value = model.Value3;
            parameters[11].Value = model.Value4;
            parameters[12].Value = model.Value5;
            parameters[13].Value = model.Value6;
            parameters[14].Value = model.Value7;
            parameters[15].Value = model.Value8;
            parameters[16].Value = model.Value9;
            parameters[17].Value = model.CreateUser;
            parameters[18].Value = model.CreateDate;
            parameters[19].Value = model.UpdateUser;
            parameters[20].Value = model.UpdateDate;
            parameters[21].Value = model.ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }