예제 #1
0
파일: Add.aspx.cs 프로젝트: tcld2269/hmdfs
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(this.txtStoreName.Text.Trim().Length==0)
            {
                strErr+="标题不能为空!\\n";
            }
            if (this.ddrCat.SelectedValue == "0")
            {
                strErr += "请选择企业类型!\\n";
            }

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

            string logo = StatusHelpercs.Default_Store_Logo;
            if (flLogo.HasFile)
            {
                string result = Common.CommonHelper.Imageupload(flLogo, "logo");
                if (result.IndexOf('|') > -1)
                {
                    logo = result.Split('|')[2];
                }
            }

            int userId = int.Parse(Request.QueryString["userId"].ToString());
            Model.users umodel = new BLL.users().GetModel(userId);

            hm.Model.store model = new hm.Model.store();
            model.storeName=txtStoreName.Text;
            model.userId = userId;
            model.userName = umodel.userName;
            model.storeType = int.Parse(ddrCat.SelectedValue);
            model.typeName = ddrCat.SelectedItem.Text;
            model.ownerCard = "";
            model.cardPic = "";
            model.addressNo = Request.Form["addressVal"].ToString();
            model.address = txtAddress.Text;
            model.logo = logo;
            model.banner = "";
            model.sale = txtSale.Text;
            model.cashPrice = decimal.Parse(txtCashPrice.Text);
            model.contact = txtContact.Text;
            model.qq = txtQQ.Text;
            model.tel = txtTel.Text;
            model.summary = "";
            model.remark = txtContent.Text;
            model.isRecommend = 0;
            model.evaluateService = 0;
            model.evaluateDesc = 0;
            model.evaluateDeliver = 0;
            model.favCount = 0;
            model.clickCount = 0;
            model.feedBack = "";
            model.lat = "";
            model.lon = "";
            model.addTime = DateTime.Now;
            model.orders = 1000;
            model.status = StatusHelpercs.Store_Status_Normal;

            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
예제 #2
0
파일: store.cs 프로젝트: tcld2269/hmdfs
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public hm.Model.store GetModel(int id)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 id,storeName,userId,userName,storeType,typeName,ownerCard,cardPic,addressNo,address,logo,banner,sale,cashPrice,contact,qq,tel,summary,remark,isRecommend,evaluateService,evaluateDesc,evaluateDeliver,favCount,clickCount,feedBack,lat,lon,addTime,orders,status from store ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)
            };
            parameters[0].Value = id;

            hm.Model.store model=new hm.Model.store();
            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=int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if(ds.Tables[0].Rows[0]["storeName"]!=null && ds.Tables[0].Rows[0]["storeName"].ToString()!="")
                {
                    model.storeName=ds.Tables[0].Rows[0]["storeName"].ToString();
                }
                if(ds.Tables[0].Rows[0]["userId"]!=null && ds.Tables[0].Rows[0]["userId"].ToString()!="")
                {
                    model.userId=int.Parse(ds.Tables[0].Rows[0]["userId"].ToString());
                }
                if(ds.Tables[0].Rows[0]["userName"]!=null && ds.Tables[0].Rows[0]["userName"].ToString()!="")
                {
                    model.userName=ds.Tables[0].Rows[0]["userName"].ToString();
                }
                if(ds.Tables[0].Rows[0]["storeType"]!=null && ds.Tables[0].Rows[0]["storeType"].ToString()!="")
                {
                    model.storeType=int.Parse(ds.Tables[0].Rows[0]["storeType"].ToString());
                }
                if(ds.Tables[0].Rows[0]["typeName"]!=null && ds.Tables[0].Rows[0]["typeName"].ToString()!="")
                {
                    model.typeName=ds.Tables[0].Rows[0]["typeName"].ToString();
                }
                if(ds.Tables[0].Rows[0]["ownerCard"]!=null && ds.Tables[0].Rows[0]["ownerCard"].ToString()!="")
                {
                    model.ownerCard=ds.Tables[0].Rows[0]["ownerCard"].ToString();
                }
                if(ds.Tables[0].Rows[0]["cardPic"]!=null && ds.Tables[0].Rows[0]["cardPic"].ToString()!="")
                {
                    model.cardPic=ds.Tables[0].Rows[0]["cardPic"].ToString();
                }
                if(ds.Tables[0].Rows[0]["addressNo"]!=null && ds.Tables[0].Rows[0]["addressNo"].ToString()!="")
                {
                    model.addressNo=ds.Tables[0].Rows[0]["addressNo"].ToString();
                }
                if(ds.Tables[0].Rows[0]["address"]!=null && ds.Tables[0].Rows[0]["address"].ToString()!="")
                {
                    model.address=ds.Tables[0].Rows[0]["address"].ToString();
                }
                if(ds.Tables[0].Rows[0]["logo"]!=null && ds.Tables[0].Rows[0]["logo"].ToString()!="")
                {
                    model.logo=ds.Tables[0].Rows[0]["logo"].ToString();
                }
                if(ds.Tables[0].Rows[0]["banner"]!=null && ds.Tables[0].Rows[0]["banner"].ToString()!="")
                {
                    model.banner=ds.Tables[0].Rows[0]["banner"].ToString();
                }
                if(ds.Tables[0].Rows[0]["sale"]!=null && ds.Tables[0].Rows[0]["sale"].ToString()!="")
                {
                    model.sale=ds.Tables[0].Rows[0]["sale"].ToString();
                }
                if(ds.Tables[0].Rows[0]["cashPrice"]!=null && ds.Tables[0].Rows[0]["cashPrice"].ToString()!="")
                {
                    model.cashPrice=decimal.Parse(ds.Tables[0].Rows[0]["cashPrice"].ToString());
                }
                if(ds.Tables[0].Rows[0]["contact"]!=null && ds.Tables[0].Rows[0]["contact"].ToString()!="")
                {
                    model.contact=ds.Tables[0].Rows[0]["contact"].ToString();
                }
                if(ds.Tables[0].Rows[0]["qq"]!=null && ds.Tables[0].Rows[0]["qq"].ToString()!="")
                {
                    model.qq=ds.Tables[0].Rows[0]["qq"].ToString();
                }
                if(ds.Tables[0].Rows[0]["tel"]!=null && ds.Tables[0].Rows[0]["tel"].ToString()!="")
                {
                    model.tel=ds.Tables[0].Rows[0]["tel"].ToString();
                }
                if(ds.Tables[0].Rows[0]["summary"]!=null && ds.Tables[0].Rows[0]["summary"].ToString()!="")
                {
                    model.summary=ds.Tables[0].Rows[0]["summary"].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]["isRecommend"]!=null && ds.Tables[0].Rows[0]["isRecommend"].ToString()!="")
                {
                    model.isRecommend=int.Parse(ds.Tables[0].Rows[0]["isRecommend"].ToString());
                }
                if(ds.Tables[0].Rows[0]["evaluateService"]!=null && ds.Tables[0].Rows[0]["evaluateService"].ToString()!="")
                {
                    model.evaluateService=int.Parse(ds.Tables[0].Rows[0]["evaluateService"].ToString());
                }
                if(ds.Tables[0].Rows[0]["evaluateDesc"]!=null && ds.Tables[0].Rows[0]["evaluateDesc"].ToString()!="")
                {
                    model.evaluateDesc=int.Parse(ds.Tables[0].Rows[0]["evaluateDesc"].ToString());
                }
                if(ds.Tables[0].Rows[0]["evaluateDeliver"]!=null && ds.Tables[0].Rows[0]["evaluateDeliver"].ToString()!="")
                {
                    model.evaluateDeliver=int.Parse(ds.Tables[0].Rows[0]["evaluateDeliver"].ToString());
                }
                if(ds.Tables[0].Rows[0]["favCount"]!=null && ds.Tables[0].Rows[0]["favCount"].ToString()!="")
                {
                    model.favCount=int.Parse(ds.Tables[0].Rows[0]["favCount"].ToString());
                }
                if(ds.Tables[0].Rows[0]["clickCount"]!=null && ds.Tables[0].Rows[0]["clickCount"].ToString()!="")
                {
                    model.clickCount=int.Parse(ds.Tables[0].Rows[0]["clickCount"].ToString());
                }
                if(ds.Tables[0].Rows[0]["feedBack"]!=null && ds.Tables[0].Rows[0]["feedBack"].ToString()!="")
                {
                    model.feedBack=ds.Tables[0].Rows[0]["feedBack"].ToString();
                }
                if(ds.Tables[0].Rows[0]["lat"]!=null && ds.Tables[0].Rows[0]["lat"].ToString()!="")
                {
                    model.lat=ds.Tables[0].Rows[0]["lat"].ToString();
                }
                if(ds.Tables[0].Rows[0]["lon"]!=null && ds.Tables[0].Rows[0]["lon"].ToString()!="")
                {
                    model.lon=ds.Tables[0].Rows[0]["lon"].ToString();
                }
                if(ds.Tables[0].Rows[0]["addTime"]!=null && ds.Tables[0].Rows[0]["addTime"].ToString()!="")
                {
                    model.addTime=DateTime.Parse(ds.Tables[0].Rows[0]["addTime"].ToString());
                }
                if(ds.Tables[0].Rows[0]["orders"]!=null && ds.Tables[0].Rows[0]["orders"].ToString()!="")
                {
                    model.orders=int.Parse(ds.Tables[0].Rows[0]["orders"].ToString());
                }
                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());
                }
                return model;
            }
            else
            {
                return null;
            }
        }