/// <summary> /// 跟据AreaId查询属性 /// </summary> /// <param name="cid"></param> /// <returns></returns> public List<ShowShop.Model.SystemInfo.PostArea> GetPostMethodByAreaId(string AreaId,string strWhere) { List<ShowShop.Model.SystemInfo.PostArea> list = new List<ShowShop.Model.SystemInfo.PostArea>(); string strSql = this.SelectSequel + "Where ','+[AreaId]+',' like '%," + AreaId + ",%'"; if (strWhere != null && strWhere != "") { strSql+=(" and " + strWhere + " "); } using (SqlDataReader reader = ChangeHope.DataBase.SQLServerHelper.ExecuteReader(strSql.ToString())) { while (reader.Read()) { ShowShop.Model.SystemInfo.PostArea model = new ShowShop.Model.SystemInfo.PostArea(); model.Id = reader.GetInt32(0); model.Deliverymode = Convert.ToInt32(reader["DeliveryMode"].ToString()); model.Areaname = reader["AreaName"].ToString(); model.Areaid = reader["AreaId"].ToString(); model.Basicfees = float.Parse(reader["BasicFees"].ToString()); model.Freeamount = float.Parse(reader["FreeAmount"].ToString()); model.CODpayfees = float.Parse(reader["CODPayFees"].ToString()); model.Feescalculationway = int.Parse(reader["FeesCalculationWay"].ToString()); model.Initialfees = float.Parse(reader["SingleProductFees"].ToString()); model.Overweight = float.Parse(reader["Overweight"].ToString()); model.Packagingcosts = float.Parse(reader["PackagingCosts"].ToString()); model.Overweight2 = float.Parse(reader["Overweight2"].ToString()); model.Putoutid = int.Parse(reader["putoutid"].ToString()); model.Putouttyid = int.Parse(reader["putouttyid"].ToString()); list.Add(model); } } return list; return null; }
protected void lbtnSave_Click(object sender, EventArgs e) { if (this.Request.Form["getid"] == "" || this.Request.Form["getid"] == null) { this.ClientScript.RegisterStartupScript(this.GetType(), "MsgBox", "<script>alert('请选择所辖地区!');</script>"); return; } ShowShop.BLL.SystemInfo.PostArea areabll = new ShowShop.BLL.SystemInfo.PostArea(); ShowShop.Model.SystemInfo.PostArea area = new ShowShop.Model.SystemInfo.PostArea(); urlid = ChangeHope.WebPage.PageRequest.GetQueryInt("delivermode"); if (urlid != -1 && urlid != 0) { area.Deliverymode = urlid; area.Areaid = Request.Form["getid"].ToString(); area.Putoutid = ViewState["PutoutID"] == null ? 0 : Convert.ToInt32(ViewState["PutoutID"].ToString()); area.Putouttyid = ViewState["PutoutTypeID"] == null ? 0 : Convert.ToInt32(ViewState["PutoutTypeID"].ToString()); switch(urlid) { case 1: area.Areaname = this.txtAreaName1.Text; break; case 2: area.Areaname = this.txtAreaName2.Text; area.Basicfees = float.Parse(this.txtBasicFees2.Text); area.CODpayfees = float.Parse(this.txtCODPayFees2.Text); area.Freeamount = float.Parse(this.txtFreeAmount2.Text); break; case 3: area.Areaname = this.txtAreaName3.Text; if (this.rdtype1.Checked) { area.Basicfees = float.Parse(this.txtBasicFrees3.Text); area.Overweight = float.Parse(this.txtOverweight3.Text); area.Feescalculationway = 1; } else { area.Initialfees = float.Parse(this.txtSingle3.Text); area.Feescalculationway = 2; } area.Freeamount = float.Parse(this.txtFreeAmount3.Text); break; case 4: area.Areaname = this.txtAreaName4.Text; area.Basicfees = float.Parse(this.txtBasicFrees4.Text); area.CODpayfees = float.Parse(this.txtCODPayFees4.Text); area.Freeamount = float.Parse(this.txtFreeAmount4.Text); break; case 5: area.Areaname = this.txtAreaName5.Text; area.Freeamount = float.Parse(this.txtFreeAmount5.Text); break; case 6: area.Areaname = this.txtAreaName6.Text; if (this.rdtype3.Checked) { area.Basicfees = float.Parse(this.txtBasicFrees6.Text); area.Overweight = float.Parse(this.txtOverweight6.Text); area.Overweight2 = float.Parse(this.txtOverweight26.Text.Trim()); area.Feescalculationway = 1; } else { area.Initialfees = float.Parse(this.txtSingle6.Text); area.Feescalculationway = 2; } area.Freeamount = float.Parse(this.txtFreeAmount6.Text); break; case 7: area.Areaname = this.txtAreaName7.Text; if (this.rdtype5.Checked) { area.Basicfees = float.Parse(this.txtBasicFrees7.Text); area.Overweight = float.Parse(this.txtOverweight7.Text); area.Overweight2 = float.Parse(this.txtOverweight27.Text); area.Feescalculationway = 1; } else { area.Initialfees = float.Parse(this.txtSingle7.Text); area.Feescalculationway = 2; } area.Freeamount = float.Parse(this.txtFreeAmount7.Text); area.Packagingcosts = float.Parse(this.txtPackagingCosts7.Text); break; case 8: area.Areaname = this.txtAreaName8.Text; if (this.rdtype7.Checked) { area.Basicfees = float.Parse(this.txtBasicFrees8.Text); area.Overweight = float.Parse(this.txtOverweight8.Text); area.Feescalculationway = 1; } else { area.Initialfees = float.Parse(this.txtSingle8.Text); area.Feescalculationway = 2; } area.Freeamount = float.Parse(this.txtFreeAmount8.Text); break; case 9: area.Areaname = this.txtAreaName9.Text; if (this.rdtype9.Checked) { area.Basicfees = float.Parse(this.txtBasicFrees9.Text); area.Overweight = float.Parse(this.txtOverweight9.Text); area.Feescalculationway = 1; } else { area.Initialfees = float.Parse(this.txtSingle9.Text); area.Feescalculationway = 2; } area.Freeamount = float.Parse(this.txtFreeAmount9.Text); break; case 10: area.Areaname = this.txtAreaName10.Text; if (this.rdtype11.Checked) { area.Basicfees = float.Parse(this.txtBasicFrees10.Text); area.Overweight = float.Parse(this.txtOverweight10.Text); area.Feescalculationway = 1; } else { area.Initialfees = float.Parse(this.txtSingle10.Text); area.Feescalculationway = 2; } area.Freeamount = float.Parse(this.txtFreeAmount10.Text); area.CODpayfees = float.Parse(this.txtCODPayFees10.Text); break; case 11: area.Areaname = this.txtAreaName11.Text; if (this.rdtype11.Checked) { area.Basicfees = float.Parse(this.txtBasicFrees11.Text); area.Overweight = float.Parse(this.txtOverweight11.Text); area.Feescalculationway = 1; } else { area.Initialfees = float.Parse(this.txtSingle11.Text); area.Feescalculationway = 2; } area.Freeamount = float.Parse(this.txtFreeAmount11.Text); break; } areaid = ChangeHope.WebPage.PageRequest.GetQueryInt("areaid"); if (areaid!=0 && areaid!= -1) { area.Id = areaid; areabll.Update(area); ChangeHope.WebPage.BasePage.PageRight("修改成功!","area_list.aspx?delivermode="+area.Deliverymode.ToString()); } else { areabll.Add(area); } this.ltlMsg.Text = "操作成功,已保存该信息"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionOk"; } }
/// <summary> /// 返回数据 /// </summary> /// <param name="row"></param> /// <returns></returns> public ShowShop.Model.SystemInfo.PostArea GetModel(System.Data.DataRow row) { ShowShop.Model.SystemInfo.PostArea model = new ShowShop.Model.SystemInfo.PostArea(); if (row != null) { model.Id = int.Parse(row["Id"].ToString()); model.Deliverymode = int.Parse(row["DeliveryMode"].ToString()); model.Areaname = row["AreaName"].ToString(); model.Areaid = row["AreaId"].ToString(); model.Basicfees = float.Parse(row["BasicFees"].ToString()); model.Freeamount = float.Parse(row["FreeAmount"].ToString()); model.CODpayfees = float.Parse(row["CODPayFees"].ToString()); model.Feescalculationway = int.Parse(row["FeesCalculationWay"].ToString()); model.Initialfees = float.Parse(row["SingleProductFees"].ToString()); model.Overweight = float.Parse(row["Overweight"].ToString()); model.Packagingcosts = float.Parse(row["PackagingCosts"].ToString()); model.Overweight2 = float.Parse(row["Overweight2"].ToString()); model.Putoutid = int.Parse(row["putoutid"].ToString()); model.Putouttyid = int.Parse(row["putouttyid"].ToString()); return model; } else { return null; } }