Beispiel #1
0
        private void BindData()
        {
            SolutionDemandModel model = bll.GetModel(DemandID);

            Literal_Demand.Text     = model.DemandDetail;
            Literal_Field.Text      = model.FieldSituation;
            Literal_Effect.Text     = model.EffectSituation;
            Literal_Budget.Text     = model.Budget.ToString("0.00");
            Literal_Contact.Text    = model.Contactor;
            Literal_Phone.Text      = model.ContactPhone;
            Literal_Postcode.Text   = model.Postcode;
            Literal_Region.Text     = model.Region;
            Literal_Address.Text    = model.Address;
            Literal_CreateTime.Text = model.CreateTime.ToString("yyyy-MM-dd HH:mm:ss");
            Literal1_Status.Text    = Enum.GetName(typeof(SolutionDemandStatus), model.Status);

            if (model.FieldPhotoes.Contains(","))
            {
                foreach (string s in model.FieldPhotoes.Split(','))
                {
                    fieldImages.InnerHtml += String.Format("<img src=\"{0}\"/>", CommonImageUpload.GetCommonImageFullUrl(s));
                }
            }
            else
            {
                fieldImages.InnerHtml += String.Format("<img src=\"{0}\"/>", CommonImageUpload.GetCommonImageFullUrl(model.FieldPhotoes));
            }
        }
        private SolutionDemandModel GetModel(DataRow row)
        {
            SolutionDemandModel model = new SolutionDemandModel()
            {
                Address         = Convert.ToString(row["Address"]),
                Budget          = Convert.ToDecimal(row["Budget"]),
                Contactor       = Convert.ToString(row["Contactor"]),
                ContactPhone    = Convert.ToString(row["ContactPhone"]),
                CreateTime      = Convert.ToDateTime(row["CreateTime"]),
                DemandDetail    = Convert.ToString(row["DemandDetail"]),
                DemandID        = Convert.ToInt32(row["DemandID"]),
                EffectSituation = Convert.ToString(row["EffectSituation"]),
                FieldPhotoes    = Convert.ToString(row["FieldPhotoes"]),
                FieldSituation  = Convert.ToString(row["FieldSituation"]),
                Postcode        = Convert.ToString(row["Postcode"]),
                Region          = Convert.ToString(row["Region"]),
                Status          = Convert.ToInt16(row["Status"]),
                UpdateTime      = Convert.ToDateTime(row["UpdateTime"]),
                UserID          = Convert.ToString(row["UserID"])
            };



            return(model);
        }
Beispiel #3
0
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "p")
     {
         int DemandID = Convert.ToInt32(e.CommandArgument);
         SolutionDemandModel model = bll.GetModel(DemandID);
         model.Status = (int)SolutionDemandStatus.已处理;
         bll.Update(model);
         BindData(AspNetPager.CurrentPageIndex);
     }
 }
        public SolutionDemandModel GetModel(int DemandID)
        {
            string sql = "select * from [slDemand] where demandid=" + DemandID;
            SolutionDemandModel model = null;

            DataTable dt = dbr.ExecuteDataSet(CommandType.Text, sql).Tables[0];

            if (dt.Rows.Count > 0)
            {
                model = GetModel(dt.Rows[0]);
            }

            return(model);
        }
        public void Update(SolutionDemandModel model)
        {
            DbCommand Command = dbw.GetStoredProcCommand("UP_slDemand_Update");

            dbw.AddInParameter(Command, "@demandid", DbType.Int32, model.DemandID);
            dbw.AddInParameter(Command, "@demanddetail", DbType.String, model.DemandDetail);
            dbw.AddInParameter(Command, "@fieldphotoes", DbType.String, model.FieldPhotoes);
            dbw.AddInParameter(Command, "@fieldsituation", DbType.String, model.FieldSituation);
            dbw.AddInParameter(Command, "@effectsituation", DbType.String, model.EffectSituation);
            dbw.AddInParameter(Command, "@budget", DbType.Decimal, model.Budget);
            dbw.AddInParameter(Command, "@contactor", DbType.String, model.Contactor);
            dbw.AddInParameter(Command, "@contactphone", DbType.String, model.ContactPhone);
            dbw.AddInParameter(Command, "@postcode", DbType.String, model.Postcode);
            dbw.AddInParameter(Command, "@region", DbType.String, model.Region);
            dbw.AddInParameter(Command, "@address", DbType.String, model.Address);
            dbw.AddInParameter(Command, "@userid", DbType.String, model.UserID);
            dbw.AddInParameter(Command, "@createtime", DbType.DateTime, model.CreateTime);
            dbw.AddInParameter(Command, "@updatetime", DbType.DateTime, model.UpdateTime);
            dbw.AddInParameter(Command, "@status", DbType.Int16, model.Status);

            dbw.ExecuteNonQuery(Command);
        }
Beispiel #6
0
 public void Update(SolutionDemandModel model)
 {
     dal.Update(model);
 }
Beispiel #7
0
 public void Add(SolutionDemandModel model)
 {
     dal.Add(model);
 }
        protected void Button_Add_Click(object sender, EventArgs e)
        {
            string ErrorMessage = String.Empty;
            if (String.IsNullOrEmpty(TextBox_DemandDetail.Text)) { ErrorMessage += "请填写需求信息\\n"; }
            if (Request.Files.Count <= 0 || Request.Files[0].ContentLength <= 0) { ErrorMessage += "场地图片不能为空\\n"; }
            if (String.IsNullOrEmpty(TextBox_Field.Text)) { ErrorMessage += "请填写场地信息\\n"; }
            if (String.IsNullOrEmpty(TextBox_Effect.Text)) { ErrorMessage += "请填写效果要求\n"; }
            if (String.IsNullOrEmpty(TextBox_Budget.Text)) { ErrorMessage += "请填写正确的预算金额\\n"; }
            if (String.IsNullOrEmpty(TextBox_Contactor.Text)) { ErrorMessage += "请填写联系人姓名\\n"; }
            if (String.IsNullOrEmpty(TextBox_Phone.Text)) { ErrorMessage += "请填写联系人电话\\n"; }
            if (String.IsNullOrEmpty(TextBox_PostCode.Text)) { ErrorMessage += "请填写邮政编码\\n"; }
            if (String.IsNullOrEmpty(TextBox_Address.Text)) { ErrorMessage += "请填写通信地址\\n"; }

            RegionInfo regionInfo = ucRegion.GetSelectedRegionInfo();
            if (String.IsNullOrEmpty(regionInfo.Province) || String.IsNullOrEmpty(regionInfo.City))
            {
                ErrorMessage += "所在地选择不完整\\n";
            }

            if (!String.IsNullOrEmpty(ErrorMessage))
            {
                MessageBox.Show(this, ErrorMessage);
                return;
            }

            SolutionDemandModel model = new SolutionDemandModel();
            int DemandID = CommDataHelper.GetNewSerialNum(AppType.Solution);
            ArrayList FieldPhotoes = new ArrayList();


            foreach (string s in Request.Files.AllKeys)
            {
                if (s.StartsWith("photo-field") && Request.Files[s].ContentLength > 0)
                {
                    string ImageUrl, ImageShorUrl, UploadMessage;
                    if (!CommonImageUpload.Upload(Request.Files[s], out ImageUrl, out ImageShorUrl, out UploadMessage))
                    {
                        MessageBox.Show(this, UploadMessage);
                        return;
                    }
                    else
                    {
                        FieldPhotoes.Add(ImageShorUrl);
                    }
                }
            }

            var ImageUrls = String.Empty;
            foreach (string s in FieldPhotoes) { ImageUrls += s+","; }


            model.DemandID = DemandID;
            model.DemandDetail = TextBox_DemandDetail.Text;
            model.FieldPhotoes = ImageUrls.Substring(0, ImageUrls.Length - 1);
            model.FieldSituation = TextBox_Field.Text;
            model.EffectSituation = TextBox_Effect.Text;
            model.Budget = Convert.ToDecimal(TextBox_Budget.Text);
            model.Contactor = TextBox_Contactor.Text;
            model.ContactPhone = TextBox_Phone.Text;
            model.Postcode = TextBox_PostCode.Text;
            model.Region = String.Format("{0} {1} {2}", regionInfo.Province, regionInfo.City, regionInfo.County);
            model.Address = TextBox_Address.Text;

            model.UserID = GetUserID();

            model.CreateTime = DateTime.Now;
            model.UpdateTime = DateTime.Now;
            model.Status = (int)SolutionDemandStatus.尚未处理;

            bll.Add(model);


            Response.Redirect("SubmitSucc.aspx?o=" + DemandID);


        }