private void btnAddDistrbutor_Click(object sender, System.EventArgs e) { if (DistributorHelper.ExistGradeName(this.txtRankName.Text.Trim())) { this.ShowMsg("已经存在相同名称的分销商等级", false); return; } DistributorGradeInfo distributorGradeInfo = new DistributorGradeInfo(); distributorGradeInfo.Name = this.txtRankName.Text.Trim(); distributorGradeInfo.Description = this.txtRankDesc.Text.Trim(); int discount; if (!int.TryParse(this.txtValue.Text, out discount) || this.txtValue.Text.Contains(".")) { this.ShowMsg("等级折扣必须只能为正整数", false); return; } distributorGradeInfo.Discount = discount; if (!this.ValidationMemberGrade(distributorGradeInfo)) { return; } if (DistributorHelper.AddDistributorGrade(distributorGradeInfo)) { this.ResetText(); this.ShowMsg("成功添加了一个分销商等级", true); return; } this.ShowMsg("添加分销商等级失败", false); }
private void btnCreateReport_Click(object sender, EventArgs e) { BalanceDetailQuery query = new BalanceDetailQuery(); query.UserName = this.userName; query.FromDate = this.dateStart; query.ToDate = this.dateEnd; query.SortBy = "TradeDate"; query.SortOrder = SortAction.Desc; query.TradeType = TradeTypes.DrawRequest; DbQueryResult distributorBalanceDetailsNoPage = DistributorHelper.GetDistributorBalanceDetailsNoPage(query); string s = ((string.Empty + "用户名") + ",交易时间" + ",业务摘要") + ",转出金额" + ",当前余额\r\n"; foreach (DataRow row in ((DataTable)distributorBalanceDetailsNoPage.Data).Rows) { s = s + row["UserName"]; s = s + "," + row["TradeDate"]; s = s + ",提现"; s = s + "," + row["Expenses"]; object obj2 = s; s = string.Concat(new object[] { obj2, ",", row["Balance"], "\r\n" }); } this.Page.Response.Clear(); this.Page.Response.Buffer = false; this.Page.Response.Charset = "GB2312"; this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=DistributionBalanceDetailsStatistics.csv"); this.Page.Response.ContentEncoding = Encoding.GetEncoding("GB2312"); this.Page.Response.ContentType = "application/octet-stream"; this.Page.EnableViewState = false; this.Page.Response.Write(s); this.Page.Response.End(); }
private void SetControl(PurchaseOrderInfo purchaseOrder) { if (!purchaseOrder.CheckAction(PurchaseOrderActions.MASTER_REJECT_REFUND)) { base.GotoResourceNotFound(); } else { Distributor distributor = DistributorHelper.GetDistributor(purchaseOrder.DistributorId); if (distributor == null) { base.GotoResourceNotFound(); } else { litDistributorName.Text = distributor.Username; litOrderId.Text = purchaseOrder.OrderId; lblOrderDate.Time = purchaseOrder.PurchaseDate; litPurchaseOrderId.Text = purchaseOrder.PurchaseOrderId; lblTotalPrice.Money = purchaseOrder.GetPurchaseTotal(); lblPurchaseStatus.PuchaseStatusCode = (int)purchaseOrder.PurchaseStatus; if (purchaseOrder.PurchaseStatus == OrderStatus.SellerAlreadySent) { lblRefundTotal.Visible = false; litRefundComment.Text = "退款金额不得大于" + lblTotalPrice.Money + "元.已发货订单允许全额或部分退款。"; } else { txtRefundTotal.Style.Add(HtmlTextWriterStyle.Display, "none"); lblRefundTotal.Money = lblTotalPrice.Money; litRefundComment.Text = "已付款等待发货订单只允许全额退款.退款后采购单自动变为关闭状态。"; } } } }
private void btnCreateReport_Click(object sender, EventArgs e) { SaleStatisticsQuery productSale = new SaleStatisticsQuery(); productSale.StartDate = this.dateStart; productSale.EndDate = this.dateEnd; productSale.PageSize = this.pager.PageSize; productSale.SortBy = "ProductSaleCounts"; productSale.SortOrder = SortAction.Desc; int totalProductSales = 0; DataTable distributionProductSalesNoPage = DistributorHelper.GetDistributionProductSalesNoPage(productSale, out totalProductSales); string s = ((string.Empty + "排行" + ",商品名称") + ",商家编码" + ",销售量") + ",销售额" + ",利润\r\n"; foreach (DataRow row in distributionProductSalesNoPage.Rows) { s = s + row["IDOfSaleTotals"].ToString(); s = s + "," + row["ProductName"].ToString(); s = s + "," + row["SKU"].ToString(); s = s + "," + row["ProductSaleCounts"].ToString(); s = s + "," + row["ProductSaleTotals"].ToString(); s = s + "," + row["ProductProfitsTotals"].ToString() + "\r\n"; } this.Page.Response.Clear(); this.Page.Response.Buffer = false; this.Page.Response.Charset = "GB2312"; this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=ProductSaleRanking.csv"); this.Page.Response.ContentEncoding = Encoding.GetEncoding("GB2312"); this.Page.Response.ContentType = "application/octet-stream"; this.Page.EnableViewState = false; this.Page.Response.Write(s); this.Page.Response.End(); }
private void btnEditDistrbutor_Click(object sender, System.EventArgs e) { DistributorGradeInfo distributorGradeInfo = new DistributorGradeInfo(); distributorGradeInfo.Name = this.txtRankName.Text.Trim(); distributorGradeInfo.Description = this.txtRankDesc.Text.Trim(); distributorGradeInfo.GradeId = this.gradeId; int discount; if (!int.TryParse(this.txtValue.Text, out discount) || this.txtValue.Text.Contains(".")) { this.ShowMsg("等级折扣必须为正整数", false); return; } distributorGradeInfo.Discount = discount; if (!this.ValidationMemberGrade(distributorGradeInfo)) { return; } if (DistributorHelper.UpdateDistributorGrade(distributorGradeInfo)) { this.ShowMsg("修改分销商等级成功", true); return; } this.ShowMsg("修改分销商等级失败", false); }
private void btnExport_Click(object sender, EventArgs e) { if (exportFieldsCheckBoxList.SelectedItem == null) { ShowMsg("请选择需要导出的分销商信息", false); } else { IList <string> fields = new List <string>(); IList <string> list2 = new List <string>(); foreach (ListItem item in exportFieldsCheckBoxList.Items) { if (item.Selected) { fields.Add(item.Value); list2.Add(item.Text); } } DataTable distributorsNopage = DistributorHelper.GetDistributorsNopage(fields); StringBuilder builder = new StringBuilder(); foreach (string str in list2) { builder.Append(str + ","); if (str == list2[list2.Count - 1]) { builder = builder.Remove(builder.Length - 1, 1); builder.Append("\r\n"); } } foreach (DataRow row in distributorsNopage.Rows) { foreach (string str2 in fields) { builder.Append(row[str2]).Append(","); if (str2 == fields[list2.Count - 1]) { builder = builder.Remove(builder.Length - 1, 1); builder.Append("\r\n"); } } } Page.Response.Clear(); Page.Response.Buffer = false; Page.Response.Charset = "GB2312"; if (exportFormatRadioButtonList.SelectedValue == "csv") { Page.Response.AppendHeader("Content-Disposition", "attachment;filename=DistributorInfo.csv"); Page.Response.ContentType = "application/octet-stream"; } else { Page.Response.AppendHeader("Content-Disposition", "attachment;filename=DistributorInfo.txt"); Page.Response.ContentType = "application/vnd.ms-word"; } Page.Response.ContentEncoding = Encoding.GetEncoding("GB2312"); Page.EnableViewState = false; Page.Response.Write(builder.ToString()); Page.Response.End(); } }
private void btnEditDistrbutor_Click(object sender, EventArgs e) { int num; DistributorGradeInfo distributorGrade = new DistributorGradeInfo(); distributorGrade.Name = txtRankName.Text.Trim(); distributorGrade.Description = txtRankDesc.Text.Trim(); distributorGrade.GradeId = gradeId; if (!(!int.TryParse(txtValue.Text, out num) || txtValue.Text.Contains("."))) { distributorGrade.Discount = num; } else { ShowMsg("等级折扣必须为正整数", false); return; } if (ValidationMemberGrade(distributorGrade)) { if (DistributorHelper.UpdateDistributorGrade(distributorGrade)) { ShowMsg("修改分销商等级成功", true); } else { ShowMsg("修改分销商等级失败", false); } } }
private void btnAddDistrbutor_Click(object sender, EventArgs e) { if (DistributorHelper.ExistGradeName(txtRankName.Text.Trim())) { ShowMsg("已经存在相同名称的分销商等级", false); } else { int num; DistributorGradeInfo distributorGrade = new DistributorGradeInfo(); distributorGrade.Name = txtRankName.Text.Trim(); distributorGrade.Description = txtRankDesc.Text.Trim(); if (!(!int.TryParse(txtValue.Text, out num) || txtValue.Text.Contains("."))) { distributorGrade.Discount = num; } else { ShowMsg("等级折扣必须只能为正整数", false); return; } if (ValidationMemberGrade(distributorGrade)) { if (DistributorHelper.AddDistributorGrade(distributorGrade)) { ResetText(); ShowMsg("成功添加了一个分销商等级", true); } else { ShowMsg("添加分销商等级失败", false); } } } }
private void grdBalanceDrawRequest_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e) { System.Web.UI.WebControls.GridViewRow gridViewRow = (System.Web.UI.WebControls.GridViewRow)((System.Web.UI.Control)e.CommandSource).NamingContainer; int num = (int)this.grdBalanceDrawRequest.DataKeys[gridViewRow.RowIndex].Value; if (e.CommandName == "UnLineReCharge") { if (DistributorHelper.DealDistributorBalanceDrawRequest(num, true)) { this.GetBalanceDrawRequest(); } else { this.ShowMsg("预付款提现申请操作失败", false); } } if (e.CommandName == "RefuseRequest") { if (DistributorHelper.DealDistributorBalanceDrawRequest(num, false)) { this.GetBalanceDrawRequest(); return; } this.ShowMsg("预付款提现申请操作失败", false); } }
private void btnEditDistributorSettings_Click(object sender, System.EventArgs e) { if (this.txtRemark.Text.Trim().Length > 300) { this.ShowMsg("合作备忘录的长度限制在300个字符以内", false); this.chkListProductLine.DataBind(); this.LoadControl(); return; } if (this.chkListProductLine.SelectedValue.Count == 0) { this.ShowMsg("请选择至少一个授权产品线", false); this.chkListProductLine.DataBind(); this.LoadControl(); return; } if (DistributorHelper.UpdateDistributorSettings(this.userId, this.drpDistributorGrade.SelectedValue.Value, this.txtRemark.Text.Trim())) { if (DistributorHelper.AddDistributorProductLines(this.userId, this.chkListProductLine.SelectedValue)) { ProductHelper.DeleteNotinProductLines(this.userId); this.ShowMsg("成功的修改了分销商基本设置", true); return; } } else { this.ShowMsg("修改失败", false); } }
protected void Page_Load(object sender, EventArgs e) { if (!(string.IsNullOrEmpty(Page.Request.QueryString["UserId"]) || int.TryParse(Page.Request.QueryString["UserId"], out userId))) { base.GotoResourceNotFound(); } else { btnSendToRank.Click += new EventHandler(btnSendToRank_Click); if (!Page.IsPostBack) { rankList.DataBind(); if (userId > 0) { Distributor distributor = DistributorHelper.GetDistributor(userId); if (distributor == null) { base.GotoResourceNotFound(); } else { txtDistributorNames.Text = distributor.Username; } } } } }
private void grdBalanceDrawRequest_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow namingContainer = (GridViewRow)((Control)e.CommandSource).NamingContainer; int userId = (int)grdBalanceDrawRequest.DataKeys[namingContainer.RowIndex].Value; if (e.CommandName == "UnLineReCharge") { if (DistributorHelper.DealDistributorBalanceDrawRequest(userId, true)) { GetBalanceDrawRequest(); } else { ShowMsg("预付款提现申请操作失败", false); } } if (e.CommandName == "RefuseRequest") { if (DistributorHelper.DealDistributorBalanceDrawRequest(userId, false)) { GetBalanceDrawRequest(); } else { ShowMsg("预付款提现申请操作失败", false); } } }
private void btnReChargeOK_Click(object sender, System.EventArgs e) { int num = 0; if (this.txtReCharge.Text.Trim().IndexOf(".") > 0) { num = this.txtReCharge.Text.Trim().Substring(this.txtReCharge.Text.Trim().IndexOf(".") + 1).Length; } decimal num2; if (!decimal.TryParse(this.txtReCharge.Text.Trim(), out num2) || num > 2) { this.ShowMsg("本次充值要给当前客户加款的金额只能是数值,且不能超过2位小数", false); return; } if (num2 < -10000000m || num2 > 10000000m) { this.ShowMsg("金额大小必须在正负1000万之间", false); return; } Hidistro.Membership.Context.Distributor distributor = Hidistro.Membership.Context.Users.GetUser(this.userId, false) as Hidistro.Membership.Context.Distributor; if (distributor == null) { this.ShowMsg("此分销商已经不存在", false); return; } decimal num3 = num2 + distributor.Balance; BalanceDetailInfo balanceDetailInfo = new BalanceDetailInfo(); balanceDetailInfo.UserId = this.userId; balanceDetailInfo.UserName = distributor.Username; balanceDetailInfo.TradeDate = System.DateTime.Now; balanceDetailInfo.TradeType = TradeTypes.BackgroundAddmoney; balanceDetailInfo.Income = new decimal?(num2); balanceDetailInfo.Balance = num3; balanceDetailInfo.Remark = Globals.HtmlEncode(this.txtRemarks.Text.Trim()); ValidationResults validationResults = Validation.Validate <BalanceDetailInfo>(balanceDetailInfo, new string[] { "ValBalanceDetail" }); string text = string.Empty; if (!validationResults.IsValid) { foreach (ValidationResult current in (System.Collections.Generic.IEnumerable <ValidationResult>)validationResults) { text += Formatter.FormatErrorMessage(current.Message); } this.ShowMsg(text, false); return; } if (DistributorHelper.AddBalance(balanceDetailInfo, num2)) { this.Page.ClientScript.RegisterClientScriptBlock(base.GetType(), "success", string.Format("<script>alert(\"本次充值已成功,充值金额:{0}\");window.location.href=\"DistributorReCharge.aspx?userId={1}\"</script>", num2, this.userId)); } this.txtReCharge.Text = string.Empty; this.txtRemarks.Text = string.Empty; this.lblUseableBalance.Money = num3; }
private void btnReChargeOK_Click(object sender, EventArgs e) { decimal num; int length = 0; if (txtReCharge.Text.Trim().IndexOf(".") > 0) { length = txtReCharge.Text.Trim().Substring(txtReCharge.Text.Trim().IndexOf(".") + 1).Length; } if (!(decimal.TryParse(txtReCharge.Text.Trim(), out num) && (length <= 2))) { ShowMsg("本次充值要给当前客户加款的金额只能是数值,且不能超过2位小数", false); } else if ((num < -10000000M) || (num > 10000000M)) { ShowMsg("金额大小必须在正负1000万之间", false); } else { Distributor user = Users.GetUser(userId, false) as Distributor; if (user == null) { ShowMsg("此分销商已经不存在", false); } else { decimal num3 = num + user.Balance; BalanceDetailInfo info2 = new BalanceDetailInfo(); info2.UserId = userId; info2.UserName = user.Username; info2.TradeDate = DateTime.Now; info2.TradeType = TradeTypes.BackgroundAddmoney; info2.Income = new decimal?(num); info2.Balance = num3; info2.Remark = Globals.HtmlEncode(txtRemarks.Text.Trim()); BalanceDetailInfo target = info2; ValidationResults results = Hishop.Components.Validation.Validation.Validate <BalanceDetailInfo>(target, new string[] { "ValBalanceDetail" }); string msg = string.Empty; if (!results.IsValid) { foreach (ValidationResult result in (IEnumerable <ValidationResult>)results) { msg = msg + Formatter.FormatErrorMessage(result.Message); } ShowMsg(msg, false); } else { if (DistributorHelper.AddBalance(target)) { ShowMsg(string.Format("本次充值已成功,充值金额:{0}", num), true); } txtReCharge.Text = string.Empty; txtRemarks.Text = string.Empty; lblUseableBalance.Money = num3; } } } }
private void btnReChargeOK_Click(object sender, EventArgs e) { decimal num; int length = 0; if (this.txtReCharge.Text.Trim().IndexOf(".") > 0) { length = this.txtReCharge.Text.Trim().Substring(this.txtReCharge.Text.Trim().IndexOf(".") + 1).Length; } if (!decimal.TryParse(this.txtReCharge.Text.Trim(), out num) || (length > 2)) { this.ShowMsg("本次充值要给当前客户加款的金额只能是数值,且不能超过2位小数", false); } else if ((num < -10000000M) || (num > 10000000M)) { this.ShowMsg("金额大小必须在正负1000万之间", false); } else { Distributor user = Users.GetUser(this.userId, false) as Distributor; if (user == null) { this.ShowMsg("此分销商已经不存在", false); } else { decimal num3 = num + user.Balance; BalanceDetailInfo target = new BalanceDetailInfo(); target.UserId = this.userId; target.UserName = user.Username; target.TradeDate = DateTime.Now; target.TradeType = TradeTypes.BackgroundAddmoney; target.Income = new decimal?(num); target.Balance = num3; target.Remark = Globals.HtmlEncode(this.txtRemarks.Text.Trim()); ValidationResults results = Hishop.Components.Validation.Validation.Validate <BalanceDetailInfo>(target, new string[] { "ValBalanceDetail" }); string msg = string.Empty; if (!results.IsValid) { foreach (ValidationResult result in (IEnumerable <ValidationResult>)results) { msg = msg + Formatter.FormatErrorMessage(result.Message); } this.ShowMsg(msg, false); } else { if (DistributorHelper.AddBalance(target, num)) { this.Page.ClientScript.RegisterClientScriptBlock(base.GetType(), "success", string.Format("<script>alert(\"本次充值已成功,充值金额:{0}\");window.location.href=\"DistributorReCharge.aspx?userId={1}\"</script>", num, this.userId)); } this.txtReCharge.Text = string.Empty; this.txtRemarks.Text = string.Empty; this.lblUseableBalance.Money = num3; } } } }
public override void DataBind() { this.Items.Clear(); base.Items.Add(new ListItem(string.Empty, string.Empty)); foreach (Distributor distributor in DistributorHelper.GetDistributors()) { base.Items.Add(new ListItem(distributor.Username, distributor.UserId.ToString())); } }
protected void Page_Load(object sender, System.EventArgs e) { if (!string.IsNullOrEmpty(base.Request["showMessage"]) && base.Request["showMessage"] == "true") { int distributorUserId = 0; if (string.IsNullOrEmpty(base.Request["userId"]) || !int.TryParse(base.Request["userId"], out distributorUserId)) { base.Response.Write("{\"Status\":\"0\"}"); base.Response.End(); return; } Hidistro.Membership.Context.SiteSettings siteSettings = Hidistro.Membership.Context.SettingsManager.GetSiteSettings(distributorUserId); if (siteSettings == null) { base.Response.Write("{\"Status\":\"0\"}"); base.Response.End(); return; } Hidistro.Membership.Context.Distributor distributor = DistributorHelper.GetDistributor(siteSettings.UserId.Value); if (distributor == null) { base.Response.Write("{\"Status\":\"0\"}"); base.Response.End(); return; } System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); stringBuilder.AppendFormat(",\"UserName\":\"{0}\"", distributor.Username); stringBuilder.AppendFormat(",\"RealName\":\"{0}\"", distributor.RealName); stringBuilder.AppendFormat(",\"CompanyName\":\"{0}\"", distributor.CompanyName); stringBuilder.AppendFormat(",\"Email\":\"{0}\"", distributor.Email); stringBuilder.AppendFormat(",\"Area\":\"{0}\"", RegionHelper.GetFullRegion(distributor.RegionId, string.Empty)); stringBuilder.AppendFormat(",\"Address\":\"{0}\"", distributor.Address); stringBuilder.AppendFormat(",\"QQ\":\"{0}\"", distributor.QQ); stringBuilder.AppendFormat(",\"MSN\":\"{0}\"", distributor.MSN); stringBuilder.AppendFormat(",\"PostCode\":\"{0}\"", distributor.Zipcode); stringBuilder.AppendFormat(",\"Wangwang\":\"{0}\"", distributor.Wangwang); stringBuilder.AppendFormat(",\"CellPhone\":\"{0}\"", distributor.CellPhone); stringBuilder.AppendFormat(",\"Telephone\":\"{0}\"", distributor.TelPhone); stringBuilder.AppendFormat(",\"RegisterDate\":\"{0}\"", distributor.CreateDate); stringBuilder.AppendFormat(",\"LastLoginDate\":\"{0}\"", distributor.LastLoginDate); stringBuilder.AppendFormat(",\"Domain1\":\"{0}\"", siteSettings.SiteUrl); base.Response.Clear(); base.Response.ContentType = "application/json"; base.Response.Write("{\"Status\":\"1\"" + stringBuilder.ToString() + "}"); base.Response.End(); } this.grdDistributorSites.RowDataBound += new System.Web.UI.WebControls.GridViewRowEventHandler(this.grdDistributorSites_RowDataBound); this.grdDistributorSites.RowCommand += new System.Web.UI.WebControls.GridViewCommandEventHandler(this.grdDistributorSites_RowCommand); this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click); this.btnSave.Click += new System.EventHandler(this.btnSave_Click); this.LoadParameters(); if (!base.IsPostBack) { this.litServerIp.Text = base.Request.ServerVariables.Get("Local_Addr"); this.BindSites(); } }
private void btnRefuseDistrbutor_Click(object sender, System.EventArgs e) { if (DistributorHelper.RefuseDistributorRequest(int.Parse(this.txtUserId.Value))) { this.ShowMsg("成功的删除了申请信息", true); this.BindDistributorRequest(); return; } this.ShowMsg("拒绝失败", false); }
private void btnCreateReport_Click(object sender, EventArgs e) { UserOrderQuery query2 = new UserOrderQuery(); query2.UserName = userName; query2.StartDate = dateStart; query2.EndDate = dateEnd; query2.PageIndex = pager.PageIndex; query2.SortBy = grdPurchaseOrderStatistics.SortOrderBy; UserOrderQuery order = query2; if (grdPurchaseOrderStatistics.SortOrder.ToLower() == "desc") { order.SortOrder = SortAction.Desc; } OrderStatisticsInfo purchaseOrdersNoPage = DistributorHelper.GetPurchaseOrdersNoPage(order); StringBuilder builder = new StringBuilder(); builder.AppendLine("<table cellspacing=\"0\" cellpadding=\"5\" rules=\"all\" border=\"1\">"); builder.AppendLine("<tr style=\"font-weight: bold; white-space: nowrap;\">"); builder.AppendLine("<td>采购单号</td>"); builder.AppendLine("<td>订单号</td>"); builder.AppendLine("<td>下单时间</td>"); builder.AppendLine("<td>分销商名称</td>"); builder.AppendLine("<td>采购单金额</td>"); builder.AppendLine("<td>利润</td>"); builder.AppendLine("</tr>"); foreach (DataRow row in purchaseOrdersNoPage.OrderTbl.Rows) { builder.AppendLine("<tr>"); builder.AppendLine("<td style=\"vnd.ms-excel.numberformat:@\">" + row["PurchaseOrderId"].ToString() + "</td>"); builder.AppendLine("<td style=\"vnd.ms-excel.numberformat:@\">" + row["OrderId"].ToString() + "</td>"); builder.AppendLine("<td>" + row["PurchaseDate"].ToString() + "</td>"); builder.AppendLine("<td>" + row["Distributorname"].ToString() + "</td>"); builder.AppendLine("<td>" + row["PurchaseTotal"].ToString() + "</td>"); builder.AppendLine("<td>" + row["PurchaseProfit"].ToString() + "</td>"); builder.AppendLine("</tr>"); } builder.AppendLine("<tr>"); builder.AppendLine("<td>当前查询结果共计," + purchaseOrdersNoPage.TotalCount + "</td>"); builder.AppendLine("<td>采购单金额共计," + purchaseOrdersNoPage.TotalOfSearch + "</td>"); builder.AppendLine("<td>采购单毛利润共计," + purchaseOrdersNoPage.ProfitsOfSearch + "</td>"); builder.AppendLine("<td></td>"); builder.AppendLine("</tr>"); builder.AppendLine("</table>"); Page.Response.Clear(); Page.Response.Buffer = false; Page.Response.Charset = "UTF-8"; Page.Response.AppendHeader("Content-Disposition", "attachment;filename=PurchaseOrderStatistics.xls"); Page.Response.ContentEncoding = Encoding.UTF8; Page.Response.ContentType = "application/ms-excel"; Page.EnableViewState = false; Page.Response.Write(builder.ToString()); Page.Response.End(); }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(base.Request["showMessage"]) && (base.Request["showMessage"] == "true")) { int result = 0; if (!(!string.IsNullOrEmpty(base.Request["requestId"]) && int.TryParse(base.Request["requestId"], out result))) { Response.Write("{\"Status\":\"0\"}"); Response.End(); return; } SiteRequestInfo siteRequestInfo = DistributorHelper.GetSiteRequestInfo(result); if (siteRequestInfo == null) { base.GotoResourceNotFound(); return; } Distributor distributor = DistributorHelper.GetDistributor(siteRequestInfo.UserId); if (distributor == null) { Response.Write("{\"Status\":\"0\"}"); Response.End(); return; } StringBuilder builder = new StringBuilder(); builder.AppendFormat(",\"UserName\":\"{0}\"", distributor.Username); builder.AppendFormat(",\"RealName\":\"{0}\"", distributor.RealName); builder.AppendFormat(",\"CompanyName\":\"{0}\"", distributor.CompanyName); builder.AppendFormat(",\"Email\":\"{0}\"", distributor.Email); builder.AppendFormat(",\"Area\":\"{0}\"", RegionHelper.GetFullRegion(distributor.RegionId, string.Empty)); builder.AppendFormat(",\"Address\":\"{0}\"", distributor.Address); builder.AppendFormat(",\"QQ\":\"{0}\"", distributor.QQ); builder.AppendFormat(",\"MSN\":\"{0}\"", distributor.MSN); builder.AppendFormat(",\"PostCode\":\"{0}\"", distributor.Zipcode); builder.AppendFormat(",\"Wangwang\":\"{0}\"", distributor.Wangwang); builder.AppendFormat(",\"CellPhone\":\"{0}\"", distributor.CellPhone); builder.AppendFormat(",\"Telephone\":\"{0}\"", distributor.TelPhone); builder.AppendFormat(",\"RegisterDate\":\"{0}\"", distributor.CreateDate); builder.AppendFormat(",\"LastLoginDate\":\"{0}\"", distributor.LastLoginDate); builder.AppendFormat(",\"Domain1\":\"{0}\"", siteRequestInfo.FirstSiteUrl); builder.AppendFormat(",\"Domain2\":\"{0}\"", siteRequestInfo.SecondSiteUrl); builder.AppendFormat(",\"IPC1\":\"{0}\"", siteRequestInfo.FirstRecordCode); builder.AppendFormat(",\"IPC2\":\"{0}\"", siteRequestInfo.SecondRecordCode); base.Response.Clear(); base.Response.ContentType = "application/json"; base.Response.Write("{\"Status\":\"1\"" + builder.ToString() + "}"); base.Response.End(); } LoadParameters(); if (!Page.IsPostBack) { BindRequests(); } }
private void LoadControl() { Hidistro.Membership.Context.Distributor distributor = DistributorHelper.GetDistributor(this.userId); if (distributor == null) { base.GotoResourceNotFound(); return; } this.litUserName.Text = distributor.Username; this.WangWangConversations.WangWangAccounts = distributor.Wangwang; }
protected void Page_Load(object sender, System.EventArgs e) { if (!string.IsNullOrEmpty(base.Request["showMessage"]) && base.Request["showMessage"] == "true") { int requestId = 0; if (string.IsNullOrEmpty(base.Request["requestId"]) || !int.TryParse(base.Request["requestId"], out requestId)) { base.Response.Write("{\"Status\":\"0\"}"); base.Response.End(); return; } SiteRequestInfo siteRequestInfo = DistributorHelper.GetSiteRequestInfo(requestId); if (siteRequestInfo == null) { base.GotoResourceNotFound(); return; } Hidistro.Membership.Context.Distributor distributor = DistributorHelper.GetDistributor(siteRequestInfo.UserId); if (distributor == null) { base.Response.Write("{\"Status\":\"0\"}"); base.Response.End(); return; } System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); stringBuilder.AppendFormat(",\"UserName\":\"{0}\"", distributor.Username); stringBuilder.AppendFormat(",\"RealName\":\"{0}\"", distributor.RealName); stringBuilder.AppendFormat(",\"CompanyName\":\"{0}\"", distributor.CompanyName); stringBuilder.AppendFormat(",\"Email\":\"{0}\"", distributor.Email); stringBuilder.AppendFormat(",\"Area\":\"{0}\"", RegionHelper.GetFullRegion(distributor.RegionId, string.Empty)); stringBuilder.AppendFormat(",\"Address\":\"{0}\"", distributor.Address); stringBuilder.AppendFormat(",\"QQ\":\"{0}\"", distributor.QQ); stringBuilder.AppendFormat(",\"MSN\":\"{0}\"", distributor.MSN); stringBuilder.AppendFormat(",\"PostCode\":\"{0}\"", distributor.Zipcode); stringBuilder.AppendFormat(",\"Wangwang\":\"{0}\"", distributor.Wangwang); stringBuilder.AppendFormat(",\"CellPhone\":\"{0}\"", distributor.CellPhone); stringBuilder.AppendFormat(",\"Telephone\":\"{0}\"", distributor.TelPhone); stringBuilder.AppendFormat(",\"RegisterDate\":\"{0}\"", distributor.CreateDate); stringBuilder.AppendFormat(",\"LastLoginDate\":\"{0}\"", distributor.LastLoginDate); stringBuilder.AppendFormat(",\"Domain1\":\"{0}\"", siteRequestInfo.FirstSiteUrl); base.Response.Clear(); base.Response.ContentType = "application/json"; base.Response.Write("{\"Status\":\"1\"" + stringBuilder.ToString() + "}"); base.Response.End(); } this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click); this.btnSave.Click += new System.EventHandler(this.btnSave_Click); this.btnRefuse.Click += new System.EventHandler(this.btnRefuse_Click); this.LoadParameters(); if (!this.Page.IsPostBack) { this.BindRequests(); } }
public override void DataBind() { this.Items.Clear(); base.Items.Add(new ListItem(this.NullToDisplay, string.Empty)); IList <Hidistro.Membership.Context.Distributor> distributors = DistributorHelper.GetDistributors(); foreach (Hidistro.Membership.Context.Distributor current in distributors) { base.Items.Add(new ListItem(current.Username, current.UserId.ToString())); } }
public override void DataBind() { this.Items.Clear(); if (this.AllowNull) { base.Items.Add(new ListItem(this.NullToDisplay, string.Empty)); } foreach (DataRow row in DistributorHelper.GetDistributorGrades().Rows) { this.Items.Add(new ListItem(Globals.HtmlDecode(row["Name"].ToString()), row["GradeId"].ToString())); } }
private void btnRefuseDistrbutor_Click(object sender, EventArgs e) { if (DistributorHelper.RefuseDistributorRequest(int.Parse(txtUserId.Value))) { ShowMsg("成功的删除了申请信息", true); BindDistributorRequest(); } else { ShowMsg("拒绝失败", false); } }
private void grdDistributorRankList_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e) { int gradeId = (int)this.grdDistributorRankList.DataKeys[e.RowIndex].Value; if (DistributorHelper.DeleteDistributorGrade(gradeId)) { this.BindDistributorRanks(); this.ShowMsg("已经成功删除选择的分销商等级", true); return; } this.ShowMsg("不能删除有分销商的分销商等级", false); }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(base.Request["showMessage"]) && (base.Request["showMessage"] == "true")) { int result = 0; if (string.IsNullOrEmpty(base.Request["userId"]) || !int.TryParse(base.Request["userId"], out result)) { base.Response.Write("{\"Status\":\"0\"}"); base.Response.End(); return; } SiteSettings siteSettings = SettingsManager.GetSiteSettings(result); if (siteSettings == null) { base.Response.Write("{\"Status\":\"0\"}"); base.Response.End(); return; } Distributor distributor = DistributorHelper.GetDistributor(siteSettings.UserId.Value); if (distributor == null) { base.Response.Write("{\"Status\":\"0\"}"); base.Response.End(); return; } StringBuilder builder = new StringBuilder(); builder.AppendFormat(",\"UserName\":\"{0}\"", distributor.Username); builder.AppendFormat(",\"RealName\":\"{0}\"", distributor.RealName); builder.AppendFormat(",\"CompanyName\":\"{0}\"", distributor.CompanyName); builder.AppendFormat(",\"Email\":\"{0}\"", distributor.Email); builder.AppendFormat(",\"Area\":\"{0}\"", RegionHelper.GetFullRegion(distributor.RegionId, string.Empty)); builder.AppendFormat(",\"Address\":\"{0}\"", distributor.Address); builder.AppendFormat(",\"QQ\":\"{0}\"", distributor.QQ); builder.AppendFormat(",\"MSN\":\"{0}\"", distributor.MSN); builder.AppendFormat(",\"PostCode\":\"{0}\"", distributor.Zipcode); builder.AppendFormat(",\"Wangwang\":\"{0}\"", distributor.Wangwang); builder.AppendFormat(",\"CellPhone\":\"{0}\"", distributor.CellPhone); builder.AppendFormat(",\"Telephone\":\"{0}\"", distributor.TelPhone); builder.AppendFormat(",\"RegisterDate\":\"{0}\"", distributor.CreateDate); builder.AppendFormat(",\"LastLoginDate\":\"{0}\"", distributor.LastLoginDate); builder.AppendFormat(",\"Domain1\":\"{0}\"", siteSettings.SiteUrl); base.Response.Clear(); base.Response.ContentType = "application/json"; base.Response.Write("{\"Status\":\"1\"" + builder.ToString() + "}"); base.Response.End(); } this.LoadParameters(); if (!base.IsPostBack) { this.BindRequests(); } }
private void BindRequests() { Pagination pagination = new Pagination(); pagination.PageIndex = this.pager.PageIndex; pagination.PageSize = this.pager.PageSize; int totalRecords = 0; System.Data.DataTable etaoRequests = DistributorHelper.GetEtaoRequests(pagination, this.userName, this.trueName, out totalRecords); this.grdDistributorSites.DataSource = etaoRequests; this.grdDistributorSites.DataBind(); this.pager.TotalRecords = totalRecords; this.pager1.TotalRecords = totalRecords; }
private void grdDistributorRankList_RowDeleting(object sender, GridViewDeleteEventArgs e) { int gradeId = (int)grdDistributorRankList.DataKeys[e.RowIndex].Value; if (DistributorHelper.DeleteDistributorGrade(gradeId)) { BindDistributorRanks(); ShowMsg("已经成功删除选择的分销商等级", true); } else { ShowMsg("不能删除有分销商的分销商等级", false); } }
private void BindSites() { Pagination pagination = new Pagination(); pagination.PageIndex = pager.PageIndex; pagination.PageSize = pager.PageSize; int total = 0; DataTable table = DistributorHelper.GetDistributorSites(pagination, userName, trueName, out total); grdDistributorSites.DataSource = table; grdDistributorSites.DataBind(); pager.TotalRecords = total; pager1.TotalRecords = total; }