예제 #1
0
 public BuildingToMarketModel GetModel()
 {
     model           = new BuildingToMarketModel();
     model.Market_id = this.ddlMarket.SelectedValue;
     model.orderby   = string.IsNullOrEmpty(this.txtSort.Text) ? 0 : Convert.ToInt32(KillSqlIn.Form_ReplaceByString(this.txtSort.Text, 10));
     return(model);
 }
예제 #2
0
 /// <summary>
 /// 确定提交
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     model = GetModel();
     if (bll.Update(model))
     {
         this.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('设置成功');layer_close_refresh();</script>");
     }
 }
예제 #3
0
 public void BindBuildingAndMarket(string Id)
 {
     if (!string.IsNullOrEmpty(Id))
     {
         model = bll.GetModel(Id);
         if (model != null)
         {
             this.txtBuilding.Text = buildingBll.GetModel(model.Building_id).Building_name;
             this.txtMarket.Text   = marketBll.GetModel(model.Market_id).Market_name;
         }
     }
 }
예제 #4
0
 public void GetAreaInfo()
 {
     if (!string.IsNullOrEmpty(_Pid))
     {
         model = bll.GetModel(_Pid);
         if (model != null)
         {
             this.txtMinPrice.Text = model.MinPrice.ToString();
             this.txtMaxPrice.Text = model.MaxPrice.ToString();
             this.txtPrice.Text    = model.Price.ToString();
             this.txtDistance.Text = model.Distance.ToString();
             ViewState["id"]       = model.BuildingToMarket_id;
         }
     }
 }
예제 #5
0
 public void GetAreaInfo()
 {
     if (!string.IsNullOrEmpty(_Pid))
     {
         model = bll.GetModel(_Pid);
         if (model != null)
         {
             this.txtBuilding.Text        = buildingBll.GetModel(model.Building_id).Building_name;
             this.hidBuildingsId.Value    = model.Building_id;
             this.ddlMarket.SelectedValue = model.Market_id;
             this.txtSort.Text            = model.orderby.ToString();
             ViewState["id"]          = model.BuildingToMarket_id;
             ViewState["Building_id"] = model.Building_id;
         }
     }
 }
예제 #6
0
 public BuildingToMarketModel GetModel()
 {
     model = new BuildingToMarketModel();
     if (!string.IsNullOrEmpty(_Pid))
     {
         BuildingToMarketModel oldModel = bll.GetModel(_Pid);
         model.BuildingToMarket_id = oldModel.BuildingToMarket_id;
         model.Building_id         = oldModel.Building_id;
         model.Market_id           = oldModel.Market_id;
         model.orderby             = oldModel.orderby;
     }
     model.MinPrice = !string.IsNullOrEmpty(this.txtMinPrice.Text) ? Convert.ToDecimal(this.txtMinPrice.Text) : 0;
     model.MaxPrice = !string.IsNullOrEmpty(this.txtMaxPrice.Text) ? Convert.ToDecimal(this.txtMaxPrice.Text) : 0;
     model.Price    = !string.IsNullOrEmpty(this.txtPrice.Text) ? Convert.ToDecimal(this.txtPrice.Text) : 0;
     model.Distance = !string.IsNullOrEmpty(this.txtDistance.Text) ? Convert.ToInt32(this.txtDistance.Text) : 0;
     return(model);
 }
예제 #7
0
 /// <summary>
 /// 确定提交
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     model = GetModel();
     if (_Pid != "SysError")
     {
         if (!this.hidBuildingsId.Value.Equals(ViewState["Building_id"].ToString())) //修改了小区
         {
             if (this.hidBuildingsId.Value.Contains("|"))                            //修改为多个小区,实为添加
             {
                 string[] ids = this.hidBuildingsId.Value.Split('|');
                 foreach (string s in ids)
                 {
                     if (bll.GetList(" Building_id = '" + s + "' and Market_id = '" + model.Market_id + "' ").Tables[0].Rows.Count <= 0)
                     {
                         model.BuildingToMarket_id = System.Guid.NewGuid().ToString();
                         model.Building_id         = s;
                         if (bll.Add(model))
                         {
                             this.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改成功');layer_close_refresh();</script>");
                         }
                     }
                 }
             }
             else//修改为一个小区
             {
                 if (bll.GetList(" Building_id = '" + this.hidBuildingsId.Value + "' and Market_id = '" + model.Market_id + "' ").Tables[0].Rows.Count <= 0)
                 {//修改的新关系不存在
                     model.BuildingToMarket_id = ViewState["id"].ToString();
                     model.Building_id         = this.hidBuildingsId.Value;
                     if (bll.Update(model))
                     {
                         this.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改成功');layer_close_refresh();</script>");
                     }
                 }
                 else
                 {
                     this.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('该关系已经存在!');</script>");
                 }
             }
         }
         else
         {
             model.BuildingToMarket_id = ViewState["id"].ToString();
             model.Building_id         = this.hidBuildingsId.Value;
             if (bll.Update(model))
             {
                 this.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script>alert('修改成功');layer_close_refresh();</script>");
             }
         }
     }
     else
     {
         string BuildingsId = this.hidBuildingsId.Value;
         if (BuildingsId.Contains("|"))
         {
             string[] ids = BuildingsId.Split('|');
             foreach (string s in ids)
             {
                 if (bll.GetList(" Building_id = '" + s + "' and Market_id = '" + model.Market_id + "' ").Tables[0].Rows.Count <= 0)
                 {
                     model.BuildingToMarket_id = System.Guid.NewGuid().ToString();
                     model.Building_id         = s;
                     if (bll.Add(model))
                     {
                         JSUtility.AlertAndRedirect("添加成功,请继续添加!", Request.RawUrl.ToString());
                     }
                 }
             }
         }
         else
         {
             model.BuildingToMarket_id = System.Guid.NewGuid().ToString();
             model.Building_id         = BuildingsId;
             if (bll.Add(model))
             {
                 JSUtility.AlertAndRedirect("添加成功,请继续添加!", Request.RawUrl.ToString());
             }
         }
     }
 }