protected void btnSubmit_Click(object sender, EventArgs e) { if (txt_account.Text.Trim() == "-1") { Message.Alert(this, "已存在该企业帐号", "null"); return; } if (dd_city.SelectedIndex == 0 || dd_province.SelectedIndex == 0) { Message.Alert(this, "请选择企业所在的地区", "null"); return; } if (txt_spNumber.Text.Trim() == "") { Message.Alert(this, "请填写企业接入号码", "null"); return; } if (txt_Wei.Text.Trim() == "") { Message.Alert(this, "请填写企业接入号码尾号", "null"); return; } Model.EnterpriseUser user = new Model.EnterpriseUser(); user.AccountCode = txt_account.Text.Trim(); user.Audit = SMSModel.AccountAuditType.Manual; if (!IsPassword(txt_pass.Text.Trim())) { Message.Alert(this, "密码必须是以字母开头,长度在6~18之间,只能包含字母、数字和下划线", "null"); return; } user.Password = txt_pass.Text.ToString(); user.Priority = SMSModel.AccountPriorityType.Level0; user.RegisterDate = DateTime.Now; user.SPNumber = txt_spNumber.Text.Trim() + txt_Wei.Text.Trim(); user.Name = txt_name.Text.Trim(); if (!IsNumeric(txt_phone.Text.Trim())) { Message.Alert(this, "手机号码输入不正确", "null"); return; } user.Phone = txt_phone.Text.Trim(); user.Address = txt_address.Text; user.Contact = txt_contact.Text; user.City = dd_city.SelectedItem.Value; user.Province = dd_province.SelectedItem.Value; user.Signature = txt_smsSigure.Text.Trim(); user.Channel = rb_SMSChannel.SelectedValue; user.Filter = (ushort)SMSModel.FilterType.Replace; user.Level = (ushort)SMSModel.LevelType.Level2; user.StatusReport = (ushort)(SMSModel.StatusReportType)(int.Parse(rb_SMSReportType.SelectedValue)); SMSModel.RPCResult <Guid> r = ZHSMSProxy.GetZKD().AddLowerAccount(((Model.EnterpriseUser)Session["Login"]).AccountCode, user); if (r.Success) { Message.Success(this, "操作成功", "null"); } else { Message.Alert(this, r.Message, "null"); } }
void load() { string code = Request.QueryString["AccountID"]; RPCResult <Model.EnterpriseUser> rr = ZHSMSProxy.GetZKD().GetEnterprise(code); if (rr.Success) { Model.EnterpriseUser user = rr.Value; if (user.AccountCode == null) { Message.Alert(this, "系统无此用户", "null"); return; } } DataTable dt = CreateTable(); SMSModel.RPCResult <string[, ]> r = ZHSMSProxy.GetZKD().GetSMSStatisticsByAccount(rr.Value.AccountCode, DateTime.Parse(txt_Start.Text), DateTime.Parse(txt_End.Text)); if (r.Success) { if (r.Value != null && r.Value.Length > 0) { string[,] str = r.Value; long sendcount = str[0, 0] == "" ? 0 : long.Parse(str[0, 0]); long failurecount = str[0, 1] == "" ? 0 : long.Parse(str[0, 1]); DataRow dr = dt.NewRow(); dr["SendCount"] = sendcount; dr["SuccessCount"] = (sendcount - failurecount).ToString(); dr["FailureCount"] = failurecount; if (sendcount == 0) { dr["SuccessRate"] = "没有短信发送"; } else { dr["SuccessRate"] = Decimal.Round(((decimal)(sendcount - failurecount) / sendcount) * 100, 2) + "%"; } dt.Rows.Add(dr); } } GridView1.DataSource = dt; GridView1.DataBind(); }