private void btnSaveComm_Click(object sender, EventArgs e) { string str = this.hiddid.Value; string uploadedImageUrl = ""; if (!string.IsNullOrEmpty(this.uploader1.UploadedImageUrl.ToString())) { uploadedImageUrl = this.uploader1.UploadedImageUrl; } else { this.ShowMsg("请选择图片上传!", false); return; } string str3 = this.txtStoreName.Text.Trim(); string str4 = this.txtOrderNum.Text.Trim(); string str5 = this.txtCommTotal.Text.Trim(); CustomDistributorStatistic custom = new CustomDistributorStatistic { OrderNums = string.IsNullOrEmpty(str4) ? 0 : int.Parse(str4), Logo = uploadedImageUrl, StoreName = str3, CommTotalSum = string.IsNullOrEmpty(str5) ? 0f : float.Parse(str5) }; if (!string.IsNullOrEmpty(str)) { custom.id = int.Parse(str); DataTable customDistributorStatistic = VShopHelper.GetCustomDistributorStatistic(custom.StoreName); if ((customDistributorStatistic.Rows.Count > 0) && (custom.id != int.Parse(customDistributorStatistic.Rows[0]["id"].ToString()))) { this.ShowMsg("店铺名称已经存在,请重新添加店铺名称!", false); } else { VShopHelper.UpdateCustomDistributorStatistic(custom); this.ShowMsgAndReUrl("修改成功", true, "CustomDistributorStatistics.aspx"); } } else { DataTable data = (DataTable)VShopHelper.GetCustomDistributorStatisticList().Data; if ((data != null) && (data.Rows.Count >= 10)) { this.ShowMsg("自定义排行榜最多添加10条记录!", false); } else if (VShopHelper.GetCustomDistributorStatistic(custom.StoreName).Rows.Count > 0) { this.ShowMsg("店铺名称已经存在,请重新添加店铺名称!", false); } else { VShopHelper.InsertCustomDistributorStatistic(custom); this.ShowMsgAndReUrl("添加成功", true, "CustomDistributorStatistics.aspx"); } } }
private void btnSaveComm_Click(object sender, System.EventArgs e) { string value = this.hiddid.Value; if (string.IsNullOrEmpty(this.uploader1.UploadedImageUrl.ToString())) { this.ShowMsg("请选择图片上传!", false); return; } string uploadedImageUrl = this.uploader1.UploadedImageUrl; string storeName = this.txtStoreName.Text.Trim(); string text = this.txtOrderNum.Text.Trim(); string text2 = this.txtCommTotal.Text.Trim(); CustomDistributorStatistic customDistributorStatistic = new CustomDistributorStatistic(); customDistributorStatistic.OrderNums = (string.IsNullOrEmpty(text) ? 0 : int.Parse(text)); customDistributorStatistic.Logo = uploadedImageUrl; customDistributorStatistic.StoreName = storeName; customDistributorStatistic.CommTotalSum = (string.IsNullOrEmpty(text2) ? 0f : float.Parse(text2)); if (!string.IsNullOrEmpty(value)) { customDistributorStatistic.id = int.Parse(value); System.Data.DataTable customDistributorStatistic2 = VShopHelper.GetCustomDistributorStatistic(customDistributorStatistic.StoreName); if (customDistributorStatistic2.Rows.Count > 0 && customDistributorStatistic.id != int.Parse(customDistributorStatistic2.Rows[0]["id"].ToString())) { this.ShowMsg("店铺名称已经存在,请重新添加店铺名称!", false); return; } VShopHelper.UpdateCustomDistributorStatistic(customDistributorStatistic); this.ShowMsgAndReUrl("修改成功", true, "CustomDistributorStatistics.aspx"); return; } else { System.Data.DataTable dataTable = (System.Data.DataTable)VShopHelper.GetCustomDistributorStatisticList().Data; if (dataTable != null && dataTable.Rows.Count >= 10) { this.ShowMsg("自定义排行榜最多添加10条记录!", false); return; } System.Data.DataTable customDistributorStatistic3 = VShopHelper.GetCustomDistributorStatistic(customDistributorStatistic.StoreName); if (customDistributorStatistic3.Rows.Count > 0) { this.ShowMsg("店铺名称已经存在,请重新添加店铺名称!", false); return; } VShopHelper.InsertCustomDistributorStatistic(customDistributorStatistic); this.ShowMsgAndReUrl("添加成功", true, "CustomDistributorStatistics.aspx"); return; } }
public static bool UpdateCustomDistributorStatistic(CustomDistributorStatistic custom) { return((new DistributorsDao()).UpdateCustomDistributorStatistic(custom)); }
public static bool InsertCustomDistributorStatistic(CustomDistributorStatistic custom) { return((new DistributorsDao()).InsertCustomDistributorStatistic(custom)); }