コード例 #1
0
ファイル: dinggou.aspx.cs プロジェクト: lmssong/portalSite
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Maticsoft.BLL.DingProduct   dingbll   = new Maticsoft.BLL.DingProduct();
         Maticsoft.Model.DingProduct dingmodel = new Maticsoft.Model.DingProduct();
         drpbind();
     }
 }
コード例 #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.DingProduct model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update DingProduct set ");
            strSql.Append("ProName=@ProName,");
            strSql.Append("ProXingID=@ProXingID,");
            strSql.Append("ProTypeID=@ProTypeID,");
            strSql.Append("DingNum=@DingNum,");
            strSql.Append("DingAddress=@DingAddress,");
            strSql.Append("LinkPhoto=@LinkPhoto,");
            strSql.Append("DingEmail=@DingEmail,");
            strSql.Append("DingSex=@DingSex,");
            strSql.Append("UsersName=@UsersName,");
            strSql.Append("Dingtime=@Dingtime,");
            strSql.Append("Dingcontent=@Dingcontent");
            strSql.Append(" where DingID=@DingID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@DingID",      SqlDbType.Int,         4),
                new SqlParameter("@ProName",     SqlDbType.VarChar,   200),
                new SqlParameter("@ProXingID",   SqlDbType.Int,         4),
                new SqlParameter("@ProTypeID",   SqlDbType.Int,         4),
                new SqlParameter("@DingNum",     SqlDbType.VarChar,   200),
                new SqlParameter("@DingAddress", SqlDbType.Text),
                new SqlParameter("@LinkPhoto",   SqlDbType.VarChar,   200),
                new SqlParameter("@DingEmail",   SqlDbType.VarChar,   200),
                new SqlParameter("@DingSex",     SqlDbType.Int,         4),
                new SqlParameter("@UsersName",   SqlDbType.VarChar,   200),
                new SqlParameter("@Dingtime",    SqlDbType.DateTime),
                new SqlParameter("@Dingcontent", SqlDbType.Text)
            };
            parameters[0].Value  = model.DingID;
            parameters[1].Value  = model.ProName;
            parameters[2].Value  = model.ProXingID;
            parameters[3].Value  = model.ProTypeID;
            parameters[4].Value  = model.DingNum;
            parameters[5].Value  = model.DingAddress;
            parameters[6].Value  = model.LinkPhoto;
            parameters[7].Value  = model.DingEmail;
            parameters[8].Value  = model.DingSex;
            parameters[9].Value  = model.UsersName;
            parameters[10].Value = model.Dingtime;
            parameters[11].Value = model.Dingcontent;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.DingProduct GetModel(int DingID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 DingID,ProName,ProXingID,ProTypeID,DingNum,DingAddress,LinkPhoto,DingEmail,DingSex,UsersName,Dingtime,Dingcontent from DingProduct ");
            strSql.Append(" where DingID=@DingID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@DingID", SqlDbType.Int, 4)
            };
            parameters[0].Value = DingID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["DingID"].ToString() != "")
                {
                    model.DingID = int.Parse(ds.Tables[0].Rows[0]["DingID"].ToString());
                }
                model.ProName = ds.Tables[0].Rows[0]["ProName"].ToString();
                if (ds.Tables[0].Rows[0]["ProXingID"].ToString() != "")
                {
                    model.ProXingID = int.Parse(ds.Tables[0].Rows[0]["ProXingID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["ProTypeID"].ToString() != "")
                {
                    model.ProTypeID = int.Parse(ds.Tables[0].Rows[0]["ProTypeID"].ToString());
                }
                model.DingNum     = ds.Tables[0].Rows[0]["DingNum"].ToString();
                model.DingAddress = ds.Tables[0].Rows[0]["DingAddress"].ToString();
                model.LinkPhoto   = ds.Tables[0].Rows[0]["LinkPhoto"].ToString();
                model.DingEmail   = ds.Tables[0].Rows[0]["DingEmail"].ToString();
                if (ds.Tables[0].Rows[0]["DingSex"].ToString() != "")
                {
                    model.DingSex = int.Parse(ds.Tables[0].Rows[0]["DingSex"].ToString());
                }
                model.UsersName = ds.Tables[0].Rows[0]["UsersName"].ToString();
                if (ds.Tables[0].Rows[0]["Dingtime"].ToString() != "")
                {
                    model.Dingtime = DateTime.Parse(ds.Tables[0].Rows[0]["Dingtime"].ToString());
                }
                model.Dingcontent = ds.Tables[0].Rows[0]["Dingcontent"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
コード例 #4
0
ファイル: Show.aspx.cs プロジェクト: lmssong/portalSite
 private void ShowInfo(int DingID)
 {
     Maticsoft.BLL.DingProduct   bll   = new Maticsoft.BLL.DingProduct();
     Maticsoft.Model.DingProduct model = bll.GetModel(DingID);
     this.lblDingID.Text      = model.DingID.ToString();
     this.lblProName.Text     = model.ProName;
     this.lblProXingID.Text   = model.ProXingID.ToString();
     this.lblProTypeID.Text   = model.ProTypeID.ToString();
     this.lblDingNum.Text     = model.DingNum;
     this.lblDingAddress.Text = model.DingAddress;
     this.lblLinkPhoto.Text   = model.LinkPhoto;
     this.lblDingEmail.Text   = model.DingEmail;
     this.lblDingSex.Text     = model.DingSex?"ÊÇ":"·ñ";
     this.lblUsersName.Text   = model.UsersName;
     this.lblDingtime.Text    = model.Dingtime.ToString();
     this.lblDingcontent.Text = model.Dingcontent;
 }
コード例 #5
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Maticsoft.Model.DingProduct model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into DingProduct(");
            strSql.Append("ProName,ProXingID,ProTypeID,DingNum,DingAddress,LinkPhoto,DingEmail,DingSex,UsersName,Dingtime,Dingcontent)");
            strSql.Append(" values (");
            strSql.Append("@ProName,@ProXingID,@ProTypeID,@DingNum,@DingAddress,@LinkPhoto,@DingEmail,@DingSex,@UsersName,@Dingtime,@Dingcontent)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ProName",     SqlDbType.VarChar,   200),
                new SqlParameter("@ProXingID",   SqlDbType.Int,         4),
                new SqlParameter("@ProTypeID",   SqlDbType.Int,         4),
                new SqlParameter("@DingNum",     SqlDbType.VarChar,   200),
                new SqlParameter("@DingAddress", SqlDbType.Text),
                new SqlParameter("@LinkPhoto",   SqlDbType.VarChar,   200),
                new SqlParameter("@DingEmail",   SqlDbType.VarChar,   200),
                new SqlParameter("@DingSex",     SqlDbType.Int,         4),
                new SqlParameter("@UsersName",   SqlDbType.VarChar,   200),
                new SqlParameter("@Dingtime",    SqlDbType.DateTime),
                new SqlParameter("@Dingcontent", SqlDbType.Text)
            };
            parameters[0].Value  = model.ProName;
            parameters[1].Value  = model.ProXingID;
            parameters[2].Value  = model.ProTypeID;
            parameters[3].Value  = model.DingNum;
            parameters[4].Value  = model.DingAddress;
            parameters[5].Value  = model.LinkPhoto;
            parameters[6].Value  = model.DingEmail;
            parameters[7].Value  = model.DingSex;
            parameters[8].Value  = model.UsersName;
            parameters[9].Value  = model.Dingtime;
            parameters[10].Value = model.Dingcontent;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
コード例 #6
0
        private void bind()
        {
            Maticsoft.BLL.DingProduct dingbll = new Maticsoft.BLL.DingProduct();
            int dingid = int.Parse(Request.QueryString["DingID"].ToString());

            Maticsoft.Model.DingProduct dingmodel = dingbll.GetModel(dingid);
            txtDingAddress.Text = dingmodel.DingAddress;
            txtDingcontent.Text = dingmodel.Dingcontent;
            txtDingEmail.Text   = dingmodel.DingEmail;
            txtDingNum.Text     = dingmodel.DingNum;

            txtLinkPhoto.Text             = dingmodel.LinkPhoto;
            txtProName.Text               = dingmodel.ProName;
            txtUsersName.Text             = dingmodel.UsersName;
            DrpProductXing.SelectedValue  = dingmodel.ProXingID.ToString();
            DrpProTypeTitle.SelectedValue = dingmodel.ProTypeID.ToString();
            DrpSex.SelectedValue          = dingmodel.DingSex.ToString();
        }
コード例 #7
0
ファイル: Adddinggou.aspx.cs プロジェクト: lmssong/portalSite
        protected void Button1_Click(object sender, EventArgs e)
        {
            Maticsoft.BLL.DingProduct   dingbll   = new Maticsoft.BLL.DingProduct();
            Maticsoft.Model.DingProduct dingmodel = new Maticsoft.Model.DingProduct();
            if (txtUsersName.Text.Trim() == "")
            {
                lblUsersName.Text = "请填写用户名!";
                return;
            }
            dingmodel.UsersName = txtUsersName.Text.Trim();
            lblUsersName.Text   = "";
            if (txtDingAddress.Text.Trim() == "")
            {
                lblDingAddress.Text = "请您填写订货地址!";
                return;
            }
            dingmodel.DingAddress = txtDingAddress.Text.Trim();
            lblDingAddress.Text   = "";
            if (txtDingcontent.Text.Trim() == "")
            {
                lblDingContent.Text = "请填写订购描述!";
                return;
            }
            dingmodel.Dingcontent = txtDingcontent.Text.Trim();
            lblDingContent.Text   = "";
            if (txtDingEmail.Text.Trim() == "")
            {
                lblDingEmail.Text = "请填写订购邮箱!";
                return;
            }
            dingmodel.DingEmail = txtDingEmail.Text.Trim();
            lblDingEmail.Text   = "";
            if (txtDingNum.Text.Trim() == "")
            {
                lblNum.Text = "请填写订购数量!";
                return;
            }
            dingmodel.DingNum = txtDingNum.Text.Trim();
            lblNum.Text       = "";
            if (DrpSex.SelectedValue == "2")
            {
                Label1.Text = "请选择性别";
                return;
            }
            dingmodel.DingSex = DrpSex.SelectedIndex;
            Label1.Text       = "";
            if (txtDingtime.Text.Trim() == "")
            {
                lblDatatime.Text = "请填写订购时间";
                return;
            }
            dingmodel.Dingtime = Convert.ToDateTime(txtDingtime.Text.Trim());
            lblDatatime.Text   = "";
            if (txtLinkPhoto.Text.Trim() == "")
            {
                lblLinkPhoto.Text = "请填写您的电话";
                return;
            }
            dingmodel.LinkPhoto = txtLinkPhoto.Text.Trim();
            lblLinkPhoto.Text   = "";
            if (txtProName.Text.Trim() == "")
            {
                lblProName.Text = "请填写产品名称!";
                return;
            }
            dingmodel.ProName   = txtProName.Text.Trim(); lblProName.Text = "";
            dingmodel.ProTypeID = int.Parse(DrpProTypeTitle.SelectedValue);
            if (DrpProductXing.SelectedValue == "")
            {
                lblxing.Text = "请选择您的产品型号";
                return;
            }
            else
            {
                dingmodel.ProXingID = int.Parse(DrpProductXing.SelectedValue);
                lblxing.Text        = "";
                dingbll.Add(dingmodel);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息添加成功!')</script>");
            }

            txtDingAddress.Text = string.Empty;
            txtDingcontent.Text = string.Empty;
            txtDingEmail.Text   = string.Empty;
            txtDingtime.Text    = string.Empty;
            txtLinkPhoto.Text   = string.Empty;
            txtProName.Text     = string.Empty;
            txtUsersName.Text   = string.Empty;
        }
コード例 #8
0
ファイル: Add.aspx.cs プロジェクト: lmssong/portalSite
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtProName.Text.Trim().Length == 0)
            {
                strErr += "ProName不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtProXingID.Text))
            {
                strErr += "ProXingID格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtProTypeID.Text))
            {
                strErr += "ProTypeID格式错误!\\n";
            }
            if (this.txtDingNum.Text.Trim().Length == 0)
            {
                strErr += "DingNum不能为空!\\n";
            }
            if (this.txtDingAddress.Text.Trim().Length == 0)
            {
                strErr += "DingAddress不能为空!\\n";
            }
            if (this.txtLinkPhoto.Text.Trim().Length == 0)
            {
                strErr += "LinkPhoto不能为空!\\n";
            }
            if (this.txtDingEmail.Text.Trim().Length == 0)
            {
                strErr += "DingEmail不能为空!\\n";
            }
            if (this.txtUsersName.Text.Trim().Length == 0)
            {
                strErr += "UsersName不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtDingtime.Text))
            {
                strErr += "Dingtime格式错误!\\n";
            }
            if (this.txtDingcontent.Text.Trim().Length == 0)
            {
                strErr += "Dingcontent不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string   ProName     = this.txtProName.Text;
            int      ProXingID   = int.Parse(this.txtProXingID.Text);
            int      ProTypeID   = int.Parse(this.txtProTypeID.Text);
            string   DingNum     = this.txtDingNum.Text;
            string   DingAddress = this.txtDingAddress.Text;
            string   LinkPhoto   = this.txtLinkPhoto.Text;
            string   DingEmail   = this.txtDingEmail.Text;
            bool     DingSex     = this.chkDingSex.Checked;
            string   UsersName   = this.txtUsersName.Text;
            DateTime Dingtime    = DateTime.Parse(this.txtDingtime.Text);
            string   Dingcontent = this.txtDingcontent.Text;

            Maticsoft.Model.DingProduct model = new Maticsoft.Model.DingProduct();
            model.ProName     = ProName;
            model.ProXingID   = ProXingID;
            model.ProTypeID   = ProTypeID;
            model.DingNum     = DingNum;
            model.DingAddress = DingAddress;
            model.LinkPhoto   = LinkPhoto;
            model.DingEmail   = DingEmail;
            model.DingSex     = DingSex;
            model.UsersName   = UsersName;
            model.Dingtime    = Dingtime;
            model.Dingcontent = Dingcontent;

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