protected void btnModify_Click(object sender, EventArgs e) { Hi.Model.SYS_AdminUser User = new Hi.BLL.SYS_AdminUser().GetModel(UserID); string OldLoginPwd = this.txtOldPassWord.Value.Trim().ToString(); string NewLoginPwd = this.txtNewPassWord.Value.Trim().ToString(); string ConfrimNewPassWord = this.txtConfrimNewPassWord.Value.Trim(); //修改的密码,两次填写不一致 if (ConfrimNewPassWord == NewLoginPwd) { if (User.LoginPwd.ToString() == OldLoginPwd) { if (new Hi.BLL.SYS_AdminUser().UpdatePassWord(NewLoginPwd, UserID.ToString())) { JScript.AlertMsgMo(this, "修改成功", "function(){ window.location.href='changePwd.aspx'; }"); } } else { JScript.AlertMsg(this, "原始密码错误,请重新输入!"); return; } } else { JScript.AlertMsg(this, "密码填写不一致!"); return; } }
protected void btnAdd_Click(object sender, EventArgs e) { try { Hi.Model.PAY_PaymentLog paymentlog = new Hi.Model.PAY_PaymentLog(); paymentlog.OrgCode = Common.NoHTML(Convert.ToString(ViewState["guid"])); paymentlog.PayCode = Common.NoHTML(txtsm.Value); paymentlog.Message = Common.NoHTML(txtqssbyy.Value); paymentlog.PayorgCode = Common.NoHTML(ddrcljg.Value); paymentlog.PayTime = Convert.ToDateTime(txtArriveDate.Value); paymentlog.Remark = Common.NoHTML(this.HidFfileName.Value); int num = new Hi.BLL.PAY_PaymentLog().Add(paymentlog); if (num > 0) { if (ddrcljg.Value == "1") { string upsql = "update pay_paylog set markname='9999' where number='" + Common.NoHTML(Convert.ToString(ViewState["guid"])) + "'"; SqlHelper.ExecuteSql(SqlHelper.LocalSqlServer, upsql); } JScript.AlertMsg(this, "处理成功", "RepPayList.aspx"); } else { JScript.AlertMsg(this, "处理失败", "RepPayList.aspx"); } } catch (Exception ex) { throw new Exception(); } }
protected void btnAdd_Click(object sender, EventArgs e) { Hi.Model.SYS_AdminUser user = new Hi.Model.SYS_AdminUser(); user.UserType = 4; if (Common.SysUserExistsAttribute("LoginName", txtUserName.Value.Trim())) { JScript.AlertMsg(this, "该用户已存在。"); return; } if (ddlOrg.SelectedValue == "-1") { JScript.AlertMsg(this, "请选择机构。"); return; } if (txtUserName.Value.Trim() == "") { JScript.AlertMsg(this, "登录帐号不能为空。"); return; } user.LoginName = Common.NoHTML(txtUserName.Value.Trim()); user.LoginPwd = Util.md5(txtUserPwd.Value.Trim()); user.Phone = Common.NoHTML(txtUserPhone.Value.Trim()); user.TrueName = Common.NoHTML(txtUserTrueName.Value.Trim()); user.CreateDate = DateTime.Now; user.IsEnabled = 1; user.CreateUserID = UserID; user.ts = DateTime.Now; user.modifyuser = UserID; user.OrgID = int.Parse(ddlOrg.SelectedValue); new Hi.BLL.SYS_AdminUser().Add(user); ClientScript.RegisterStartupScript(this.GetType(), "msg", "<script>window.location.href='OrgUserList.aspx';</script>"); }
protected void btnAdd_Click(object sender, EventArgs e) { SqlTransaction Tran = DBUtility.SqlHelper.CreateStoreTranSaction(); Hi.Model.SYS_Users user = new Hi.Model.SYS_Users(); if (Common.GetUserExists(txtUserName.Value.Trim())) { JScript.AlertMsg(this, "登录帐号已存在。"); return; } if (Common.GetUserExists("Phone", txtUserPhone.Value.Trim())) { JScript.AlertMsg(this, "手机号码已存在。"); return; } user.UserName = Common.NoHTML(txtUserName.Value.Trim()); user.TrueName = Common.NoHTML(txtUserTrueName.Value.Trim()); user.UserPwd = Util.md5(txtUserPwd.Value.Trim()); user.Phone = Common.NoHTML(txtUserPhone.Value.Trim()); user.AuditState = 2; user.IsEnabled = 1; user.CreateDate = DateTime.Now; user.CreateUserID = UserID; user.ts = DateTime.Now; user.modifyuser = UserID; int userid = new Hi.BLL.SYS_Users().Add(user, Tran); Hi.Model.SYS_CompUser CompUser = new Hi.Model.SYS_CompUser(); CompUser.CompID = KeyID; CompUser.DisID = 0; CompUser.CreateDate = DateTime.Now; CompUser.CreateUserID = UserID; CompUser.modifyuser = UserID; CompUser.CType = 1; CompUser.UType = 3; CompUser.IsEnabled = 1; CompUser.IsAudit = 2; CompUser.ts = DateTime.Now; CompUser.dr = 0; CompUser.UserID = userid; CompUser.RoleID = 0; new Hi.BLL.SYS_CompUser().Add(CompUser, Tran); //新增角色用户 List <Hi.Model.SYS_Role> list = new Hi.BLL.SYS_Role().GetList("", "isnull(dr,0)=0 and IsEnabled=1 and CompID=" + KeyID + " and RoleName='企业管理员'", ""); Hi.Model.SYS_RoleUser RoleUser = new Hi.Model.SYS_RoleUser(); RoleUser.FunType = 1; RoleUser.UserID = userid; RoleUser.RoleID = list[0].ID; RoleUser.IsEnabled = true; RoleUser.CreateUser = this.UserID.ToString(); RoleUser.CreateDate = DateTime.Now; RoleUser.ts = DateTime.Now; RoleUser.dr = 0; new Hi.BLL.SYS_RoleUser().Add(RoleUser, Tran); Tran.Commit(); JScript.AlertMsgMo(this, "添加成功", "function(){ window.location.href=window.location.href; }"); }
protected void btnAdd_Click(object sender, EventArgs e) { Hi.Model.SYS_Users user = new Hi.Model.SYS_Users(); int rolid = 0; if (Common.GetUserExists(txtUserName.Value.Trim())) { JScript.AlertMsg(this, "该用户已存在。"); return; } if (!int.TryParse(HidRoid.Value, out rolid) || HidRoid.Value == "-1") { JScript.AlertMsg(this, "未选择岗位。"); return; } if (Common.GetUserExists("Phone", txtUserPhone.Value.Trim())) { JScript.AlertMsg(this, "手机号码已存在。"); return; } SqlTransaction Tran = DBUtility.SqlHelper.CreateStoreTranSaction(); rolid = HidRoid.Value.ToInt(0); user.UserName = Common.NoHTML(txtUserName.Value.Trim()); user.TrueName = Common.NoHTML(txtTrueName.Value.Trim()); user.UserPwd = Util.md5(txtUserPwd.Value.Trim()); user.Phone = Common.NoHTML(txtUserPhone.Value.Trim()); user.AuditState = 2; user.IsEnabled = 1; user.CreateDate = DateTime.Now; user.CreateUserID = UserID; user.ts = DateTime.Now; user.modifyuser = UserID; int userid = new Hi.BLL.SYS_Users().Add(user, Tran); Hi.Model.SYS_CompUser CompUser = new Hi.Model.SYS_CompUser(); CompUser.CompID = TextComp.Compid.ToInt(0); CompUser.DisID = 0; CompUser.CreateDate = DateTime.Now; CompUser.CreateUserID = UserID; CompUser.modifyuser = UserID; CompUser.CType = 1; CompUser.UType = 3; CompUser.IsEnabled = 1; CompUser.IsAudit = 2; CompUser.ts = DateTime.Now; CompUser.dr = 0; CompUser.UserID = userid; CompUser.RoleID = rolid; new Hi.BLL.SYS_CompUser().Add(CompUser, Tran); Tran.Commit(); string str = string.Format("医站通提示:\n尊敬的用户您好,管理员给您创建了一个帐号为{0}的用户,请登录网站查看\n【医站通】", user.UserName); JScript.AlertMsgMo(this, "添加成功", "function(){ window.location.href='CompUserList.aspx?page=" + page + "'; }"); }
protected void btnSubMit_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(txt_SelectValue.Value)) { int count = txt_SelectValue.Value.Split(',').Length; if (txt_SelectValue.Value.Split(',').Length > 6) { JScript.AlertMsg(this, "最多设置6个热词"); } else { List <Hi.Model.SYS_SysName> SysNameList = new Hi.BLL.SYS_SysName().GetList("", " name='搜索热词' and dr=0 ", ""); if (SysNameList.Count > 0) { Hi.Model.SYS_SysName sysname = SysNameList[0]; sysname.Value = txt_SelectValue.Value; sysname.ts = DateTime.Now; sysname.modifyuser = this.UserID; if (new Hi.BLL.SYS_SysName().Update(sysname)) { JScript.AlertMsg(this, "设置成功"); } else { JScript.AlertMsg(this, "失败"); } } else { Hi.Model.SYS_SysName sysname = new Hi.Model.SYS_SysName(); sysname.CompID = 0; sysname.Code = "0001"; sysname.Name = "搜索热词"; sysname.Value = txt_SelectValue.Value; sysname.ts = DateTime.Now; sysname.dr = 0; sysname.modifyuser = this.UserID; if (new Hi.BLL.SYS_SysName().Add(sysname) > 0) { JScript.AlertMsg(this, "设置成功"); } else { JScript.AlertMsg(this, "失败"); } } } } ClientScript.RegisterStartupScript(this.GetType(), "MSG", "<script>window.parent.location.href=window.parent.location.href; </script>"); }
public void DataBinds() { if (KeyID != 0) { Hi.Model.BD_Distributor Dis = new Hi.BLL.BD_Distributor().GetModel(KeyID); if (Dis != null) { lblDisName.InnerText = Dis.DisName; //lblTyoeName.InnerText = Common.GetDisTypeNameById(Dis.DisTypeID); //lblAreaName.InnerText = Common.GetDisAreaNameById(Dis.AreaID); //lblDisLevel.InnerText = Dis.DisLevel; lblLeading.InnerText = Dis.Leading; lblLeadingPhone.InnerText = Dis.LeadingPhone; lblFax.InnerText = Dis.Fax; lblTel.InnerText = Dis.Tel; lblLicence.InnerText = Dis.Licence; lblPerson.InnerText = Dis.Principal; lblPhone.InnerText = Dis.Phone; lblAddress.InnerText = Dis.Address; lblZip.InnerText = Dis.Zip; lblRemark.InnerText = Dis.Remark; lblIsEnabled.InnerHtml = Dis.IsEnabled == 1 ? "启用" : "<i style='color:red;'>禁用</i>"; if (Dis.IsEnabled == 1) { libtnNUse.Visible = true; libtnUse.Visible = false; } else { libtnUse.Visible = true; libtnNUse.Visible = false; } //rdAuditYes.InnerHtml = Dis.IsCheck == 1 ? "是" : "<i style='color:red;'>否</i>"; //rdCreditYes.InnerHtml = Dis.CreditType == 0 ? "<i style='color:red;'>否</i>" : "是"; } else { JScript.AlertMsg(this, "代理商不存在!"); return; } } else { JScript.AlertMsg(this, "数据错误!"); return; } }
/// <summary> /// 启用或停用方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void IsEnabledbtn_Click(object sender, EventArgs e) { hid = Request.QueryString["hid"] + ""; Hi.Model.SYS_Hospital hospital = new Hi.BLL.SYS_Hospital().GetModel(Convert.ToInt32(hid)); hospital.IsEnabled = hospital.IsEnabled?false :true; if (new Hi.BLL.SYS_Hospital().Update(hospital)) { JScript.AlertMsg(this, "" + this.IsEnabled.InnerText + "成功", ""); Response.Redirect("hospitalInfo.aspx?hid=" + hospital.ID); } else { JScript.AlertMsg(this, "操作失败", "function (){ window.location.reload(); }"); } }
protected void btnSubMit_Click(object sender, EventArgs e) { if (ViewState["Userid"] != null) { if (string.IsNullOrWhiteSpace(txt_NewPhone.Value.Trim())) { JScript.AlertMsg(this, "新手机号码不能为空!。"); return; } int Userid = ViewState["Userid"].ToString().ToInt(0); Hi.Model.SYS_Users User = new Hi.BLL.SYS_Users().GetModel(Userid); if (User != null) { User.Phone = Common.NoHTML(txt_NewPhone.Value.Trim()); new Hi.BLL.SYS_Users().Update(User); ClientScript.RegisterStartupScript(this.GetType(), "MSG", "<script>window.parent.location.href=window.parent.location.href; </script>"); } } }
protected void btnSubMit_Click(object sender, EventArgs e) { Hi.Model.BD_Company comp = new Hi.BLL.BD_Company().GetModel(KeyID); if (comp != null) { if (string.IsNullOrWhiteSpace(txtCreateDate.Value.Trim())) { JScript.AlertMsg(this, "起始日期不能为空"); return; } if (string.IsNullOrWhiteSpace(txtEndCreateDate.Value.Trim())) { JScript.AlertMsg(this, "结束日期不能为空"); return; } comp.EnabledStartDate = Convert.ToDateTime(txtCreateDate.Value); comp.EnabledEndDate = Convert.ToDateTime(txtEndCreateDate.Value); new Hi.BLL.BD_Company().Update(comp); ClientScript.RegisterStartupScript(this.GetType(), "MSG", "<script>window.parent.location.href=window.parent.location.href; </script>"); } }
public void Download_Click(object sender, EventArgs e) { LinkButton bt = sender as LinkButton; string fileName = bt.Attributes["fileName"]; string filePath = Server.MapPath("../../UploadFile/") + fileName; if (File.Exists(filePath)) { FileInfo file = new FileInfo(filePath); Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8"); //解决中文乱码 Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(file.Name.Substring(0, file.Name.LastIndexOf("_")) + Path.GetExtension(file.Name))); //解决中文文件名乱码 Response.AddHeader("Content-length", file.Length.ToString()); Response.ContentType = "application/octet-stream"; Response.WriteFile(file.FullName); Response.Flush(); Response.End(); } else { JScript.AlertMsg(this, "附件不存在"); } }
protected void btnAdd_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtRemark.Text.Trim())) { JScript.AlertMsg(this, "处理结果不能为空!"); return; } Hi.Model.SYS_UserMessage Message = null; if (KeyID != 0) { Message = new Hi.BLL.SYS_UserMessage().GetModel(KeyID); Message.State = 1; Message.ModifyDate = DateTime.Now; Message.ModifyUser = UserID; Message.Remark = Common.NoHTML(txtRemark.Text.Trim()); if (new Hi.BLL.SYS_UserMessage().Update(Message)) { Response.Redirect("MessageList.aspx"); } } }
/// <summary> /// 绑定产品信息 /// </summary> /// <param name="id"></param> public void Bind(int id, int goodsInfoId, int compId) { Hi.Model.BD_Goods model = new Hi.BLL.BD_Goods().GetModel(id); if (model != null && model.dr == 0 && model.IsEnabled == 1) { Hi.Model.BD_GoodsInfo model2 = new Hi.BLL.BD_GoodsInfo().GetModel(goodsInfoId); if (model2 != null) { this.lblCode.InnerText = model2.BarCode.Trim(); //商品编号 this.lblInventory.InnerText = model2.Inventory.ToString(); //库存 } Hi.Model.BD_GoodsCategory model3 = new Hi.BLL.BD_GoodsCategory().GetModel(model.CategoryID); if (model3 != null) { this.lblCategory.InnerText = model3.CategoryName.Trim(); //分类 } GetZiDingYi(model); //自定义字段 this.divTitle.InnerText = model.GoodsName.Trim(); //biaot this.divMemo.InnerHtml = model.Title.Trim(); //描述 this.lblHideInfo1.InnerText = model.HideInfo1; this.lblHideInfo2.InnerText = model.HideInfo2; //描述 this.lblUnit.InnerText = model.Unit.Trim(); //计量单位 if (model.Details == "") { this.DivShow.InnerHtml = "<p style=\"padding-top: 20px; line-height: 40px; padding-left: 20px\">暂无数据</p>"; } else { this.DivShow.InnerHtml = model.Details; } if (!string.IsNullOrEmpty(model.Pic))//有图片 { this.imgPic.Src = Common.GetPicURL(model.Pic, "resize400"); this.imgPic.Attributes.Add("jqimg", Common.GetPicURL(model.Pic)); this.imgPic2.Src = Common.GetPicURL(model.Pic, "resize400"); this.imgPic2.Attributes.Add("bimg", Common.GetPicURL(model.Pic)); } else { this.imgPic.Src = "../../images/havenopicmax.gif"; //无图片 this.imgPic2.Src = "../../images/havenopicmax.gif"; //无图片 this.imgPic2.Attributes.Add("bimg", "../../images/havenopicmax.gif"); this.imgPic.Attributes.Add("jqimg", "../../images/havenopicmax.gif"); } //add by hgh 设置商品是否首页显示 this.labText.Text = model.IsFirstShow == true ? "是" : "否"; } else { JScript.AlertMsg(this, "商品不存在或者已经被删除", "GoodsInfoList.aspx"); return; } string html = string.Empty; List <Hi.Model.BD_GoodsAttrs> ll = new Hi.BLL.BD_GoodsAttrs().GetList("", "isnull(dr,0)=0 and compId=" + compId + " and goodsId=" + id.ToString(), ""); if (ll.Count > 0) { int xy = 0; foreach (Hi.Model.BD_GoodsAttrs item in ll) { List <Hi.Model.BD_GoodsAttrsInfo> lll = new Hi.BLL.BD_GoodsAttrsInfo().GetList("", "isnull(dr,0)=0 and compId=" + compId + " and attrsId=" + item.ID, ""); if (lll.Count > 0) { html += "<div class=\"li\"><i class=\"bt2\" tip=\"" + item.AttrsName + "\">" + item.AttrsName + ":</i><div class=\"fun\">"; foreach (Hi.Model.BD_GoodsAttrsInfo item2 in lll) { Hi.Model.BD_GoodsInfo model4 = new Hi.BLL.BD_GoodsInfo().GetModel(goodsInfoId); if (xy == 0) { html += "<a href=\"javascript:;\" class=\"" + (model4.Value1 == item2.AttrsInfoName.Trim() ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>"; } else if (xy == 1) { html += "<a href=\"javascript:;\" class=\"" + (model4.Value2 == item2.AttrsInfoName.Trim() ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>"; } else if (xy == 2) { html += "<a href=\"javascript:;\" class=\"" + (model4.Value3 == item2.AttrsInfoName.Trim() ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>"; } } html += "</div></div>"; } xy++; } } litAttrVaue.Text = html; }
protected void btnAdd_Click(object sender, EventArgs e) { Hi.Model.SYS_AdminUser Adminuser = null; if (txtpwd.Text.Trim() != txtpwd2.Text.Trim()) { JScript.AlertMsg(this, "两次密码不一致,请确认!"); return; } if (KeyID != 0) { Adminuser = new Hi.BLL.SYS_AdminUser().GetModel(KeyID); if (Adminuser.LoginPwd != Common.NoHTML(txtpwd.Text.Trim())) { Adminuser.LoginPwd = Util.md5(Common.NoHTML(txtpwd.Text.Trim())); } Adminuser.TrueName = Common.NoHTML(txtturename.Value.Trim()); Adminuser.Phone = Common.NoHTML(txttel.Value.Trim()); Adminuser.Remark = Common.NoHTML(txtRemark.Value.Trim()); if (this.rdoStatus1.Checked) { Adminuser.IsEnabled = 0; } else { Adminuser.IsEnabled = 1; } if (this.rdotype2.Checked) { Adminuser.UserType = 2;//系统用户 } if (salemanid.Value != "0") { Adminuser.UserType = 4;//系统用户 } Adminuser.ts = DateTime.Now; Adminuser.modifyuser = UserID; Adminuser.SalesManID = Convert.ToInt32(salemanid.Value); Adminuser.OrgID = Convert.ToInt32(orgids.Value); if (new Hi.BLL.SYS_AdminUser().Update(Adminuser)) { //JScript.AlertMsgMo(this, "操作成功", "function(){ window.location.href='UserInfo.aspx?KeyID=" + KeyID + "'; }"); Response.Redirect("UserInfo.aspx?KeyID=" + KeyID); } } else { Adminuser = new Hi.Model.SYS_AdminUser(); Adminuser.LoginName = Common.NoHTML(txtusername.Value.Trim()); if (DisExistsAttribute("LoginName", Adminuser.LoginName)) { JScript.AlertMsg(this, "该登录帐号已存在。"); return; } Adminuser.LoginPwd = Util.md5(txtpwd.Text.Trim()); Adminuser.TrueName = Common.NoHTML(txtturename.Value.Trim()); Adminuser.Phone = Common.NoHTML(txttel.Value.Trim()); if (this.rdotype2.Checked) { Adminuser.UserType = 2;//系统用户 } if (salemanid.Value != "0") { Adminuser.UserType = 4;//系统用户 } Adminuser.Remark = Common.NoHTML(txtRemark.Value.Trim()); Adminuser.RoleID = Convert.ToInt32(Request["RoleID"]); if (this.rdoStatus1.Checked) { Adminuser.IsEnabled = 0; } else { Adminuser.IsEnabled = 1; } //标准参数 Adminuser.CreateDate = DateTime.Now; Adminuser.CreateUserID = UserID; Adminuser.ts = DateTime.Now; Adminuser.modifyuser = UserID; Adminuser.SalesManID = Convert.ToInt32(salemanid.Value); Adminuser.OrgID = Convert.ToInt32(orgids.Value); int newuserid = 0; newuserid = new Hi.BLL.SYS_AdminUser().Add(Adminuser); if (newuserid > 0) { Response.Redirect("../Role/RoleInfo.aspx?KeyID=" + Request["RoleID"]); } } }
protected void btnAdd_Click(object sender, EventArgs e) { Hi.Model.SYS_GoodsType goodstype = null; if (string.IsNullOrEmpty(txtGoodsName.Value.Trim())) { JScript.AlertMsg(this, "商品分类名称不能为空!"); return; } if (KeyID != 0) { goodstype = new Hi.BLL.SYS_GoodsType().GetModel(KeyID); goodstype.GoodsTypeName = Common.NoHTML(txtGoodsName.Value.Trim()); goodstype.SortIndex = Common.NoHTML(txtSort.Value.Trim()); if (this.rdoStatus1.Checked) { goodstype.IsEnabled = 0; } else { goodstype.IsEnabled = 1; } goodstype.GoodsTypeCode = "0"; goodstype.ts = DateTime.Now; goodstype.modifyuser = UserID; if (new Hi.BLL.SYS_GoodsType().Update(goodstype)) { //JScript.AlertMsgMo(this, "操作成功", "function(){ window.location.href='GoodsTypeInfo.aspx?KeyID=" + KeyID + "'; }"); Response.Redirect("GoodsTypeInfo.aspx?KeyID=" + KeyID); } } else { goodstype = new Hi.Model.SYS_GoodsType(); goodstype.GoodsTypeName = Common.NoHTML(txtGoodsName.Value.Trim()); goodstype.SortIndex = Common.NoHTML(txtSort.Value.Trim()); if (this.rdoStatus1.Checked) { goodstype.IsEnabled = 0; } else { goodstype.IsEnabled = 1; } //标准参数 goodstype.CreateDate = DateTime.Now; goodstype.CreateUserID = UserID; goodstype.ts = DateTime.Now; goodstype.modifyuser = UserID; int newuserid = 0; newuserid = new Hi.BLL.SYS_GoodsType().Add(goodstype); if (newuserid > 0) { Response.Redirect("GoodsTypeInfo.aspx?KeyID=" + newuserid); } } }
protected void btnAdd_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(Common.NoHTML(txtNewsTitle.Value.Trim()))) { JScript.AlertMsg(this, "消息标题不能为空!"); return; } Hi.Model.SYS_NewsNotice NewsNotice = null; if (KeyID != 0) { NewsNotice = new Hi.BLL.SYS_NewsNotice().GetModel(KeyID); NewsNotice.NewsTitle = Common.NoHTML(txtNewsTitle.Value.Trim());//去除非法字符 NewsNotice.NewsInfo = Common.NoHTML(textNewsInfo.Text.Trim()); NewsNotice.KeyWords = Common.NoHTML(textKeywords.Value.Trim()); NewsNotice.NewsContents = content7.Text.Trim(); //是否启用 if (this.rdoStatus1.Checked) { NewsNotice.IsEnabled = 0; } else { NewsNotice.IsEnabled = 1; } //是否置顶 if (this.Radio3.Checked) { NewsNotice.IsTop = 1; } else { NewsNotice.IsTop = 0; } //类别 if (this.Radio1.Checked) { NewsNotice.NewsType = 1; } else if (this.Radio2.Checked) { NewsNotice.NewsType = 2; } else if (this.Radio5.Checked) { NewsNotice.NewsType = 3; } else { NewsNotice.NewsType = 4; } NewsNotice.ts = DateTime.Now; NewsNotice.modifyuser = UserID; if (new Hi.BLL.SYS_NewsNotice().Update(NewsNotice)) { //JScript.AlertMsgMo(this, "操作成功", "function(){ window.location.href='NewsInfo.aspx?KeyID=" + KeyID + "'; }"); Response.Redirect("NewsInfo.aspx?KeyID=" + KeyID); } } else { NewsNotice = new Hi.Model.SYS_NewsNotice(); NewsNotice.NewsTitle = Common.NoHTML(txtNewsTitle.Value.Trim());//去除非法字符 NewsNotice.NewsInfo = Common.NoHTML(textNewsInfo.Text.Trim()); NewsNotice.KeyWords = Common.NoHTML(textKeywords.Value.Trim()); NewsNotice.NewsContents = content7.Text.Trim(); //是否启用 if (this.rdoStatus1.Checked) { NewsNotice.IsEnabled = 0; } else { NewsNotice.IsEnabled = 1; } //是否置顶 if (this.Radio3.Checked) { NewsNotice.IsTop = 1; } else { NewsNotice.IsTop = 0; } //类别 if (this.Radio1.Checked) { NewsNotice.NewsType = 1; } else if (this.Radio2.Checked) { NewsNotice.NewsType = 2; } else if (this.Radio5.Checked) { NewsNotice.NewsType = 3; } else { NewsNotice.NewsType = 4; } //标准参数 NewsNotice.CreateDate = DateTime.Now; NewsNotice.CreateUserID = UserID; NewsNotice.ts = DateTime.Now; NewsNotice.modifyuser = UserID; int newsrid = 0; newsrid = new Hi.BLL.SYS_NewsNotice().Add(NewsNotice); if (newsrid > 0) { Response.Redirect("NewsInfo.aspx?KeyID=" + newsrid); } } }
/// <summary> /// 生成订单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnCopyOrder_Click(object sender, EventArgs e) { decimal TotalAmount = 0; //订单总价 Hi.Model.DIS_Order OrderInfoModel = null; OrderInfoModel = OrderInfoBll.GetModel(Id); if (OrderInfoModel != null) { OrderInfoModel.ReceiptNo = SysCode.GetNewCode("销售单"); //TotalAmount 总价 //AuditAmount 审核后总价 //OtherAmount 其它费用 OrderInfoModel.PayState = (int)Enums.PayState.未支付; OrderInfoModel.OState = (int)Enums.OrderState.待审核; OrderInfoModel.PayedAmount = 0; OrderInfoModel.ReturnState = 0; OrderInfoModel.DisUserID = this.UserID; OrderInfoModel.CreateUserID = this.UserID; OrderInfoModel.CreateDate = DateTime.Now; OrderInfoModel.AuditUserID = 0; OrderInfoModel.AuditDate = DateTime.MinValue; OrderInfoModel.AuditRemark = ""; OrderInfoModel.ReturnMoneyDate = DateTime.MinValue; OrderInfoModel.ReturnMoneyUserId = 0; OrderInfoModel.ReturnMoneyUser = ""; OrderInfoModel.ts = DateTime.Now; OrderInfoModel.dr = 0; OrderInfoModel.modifyuser = 0; List <Hi.Model.DIS_OrderDetail> l = OrderDetailBll.GetList("", " OrderId=" + Id, ""); List <Hi.Model.DIS_OrderDetail> dl = new List <Hi.Model.DIS_OrderDetail>(); foreach (Hi.Model.DIS_OrderDetail item in l) { item.Price = 0; item.AuditAmount = 0; item.sumAmount = item.Price * item.GoodsNum; TotalAmount += item.sumAmount; item.ts = DateTime.Now; item.dr = 0; item.modifyuser = 0; dl.Add(item); } OrderInfoModel.TotalAmount = TotalAmount; OrderInfoModel.AuditAmount = TotalAmount; OrderInfoModel.OtherAmount = 0; int OrderId = OrderInfoType.TansOrder(OrderInfoModel, dl); if (OrderId > 0) { //Utils.AddSysBusinessLog(this.CompID, "Order", OrderId.ToString(), "订单新增", ""); JScript.AlertMsg(this, "新增成功!", "OrderCreateInfo.aspx?Id=" + OrderId); } } }
protected void btnAdd_Click(object sender, EventArgs e) { if (KeyID > 0) { bool Audit = false; Hi.Model.BD_Company comp = new Hi.BLL.BD_Company().GetModel(KeyID); if (comp != null) { if (comp.dr == 1) { JScript.AlertMsg(this, "厂商不存在!。"); return; } string str = string.Empty; SqlTransaction Tran = null; try { if (comp.AuditState == 2) { Audit = true; } if (Common.CompExistsAttribute("CompName", txtCompName.Value.Trim(), KeyID.ToString())) { JScript.AlertMsg(this, "该厂商名称已存在。"); return; } string CompAddr = hidProvince.Value.Trim(); if (!string.IsNullOrWhiteSpace(hidCity.Value.Trim()) && hidCity.Value.Trim() != "选择市") { CompAddr += "-" + hidCity.Value.Trim(); } if (!string.IsNullOrWhiteSpace(hidArea.Value.Trim()) && hidArea.Value.Trim() != "选择区") { CompAddr += "-" + hidArea.Value.Trim(); } comp.CompAddr = CompAddr; comp.CompName = Common.NoHTML(txtCompName.Value.Trim()); comp.Capital = Capital.Value.Trim(); comp.CompType = Convert.ToInt32(CompType.SelectedValue); comp.Tel = Common.NoHTML(txtTel.Value.Trim()); if (txtPrincipal.Value.Trim() != "") { comp.Principal = Common.NoHTML(txtPrincipal.Value.Trim()); } else { comp.Principal = Common.NoHTML(txtUserTrueName.Value.Trim()); } comp.Legal = Common.NoHTML(txtLegal.Value.Trim()); if (txtPhone.Value.Trim() != "") { comp.Phone = Common.NoHTML(txtPhone.Value.Trim()); } else { comp.Phone = Common.NoHTML(txtUserPhone.Value.Trim()); } comp.ShortName = Common.NoHTML(txtShotName.Value.Trim()); comp.Zip = Common.NoHTML(txtZip.Value.Trim()); comp.Identitys = Common.NoHTML(txtIdentitys.Value.Trim()); comp.Licence = Common.NoHTML(txtLicence.Value.Trim()); comp.LegalTel = Common.NoHTML(txtLegalTel.Value.Trim()); comp.ManageInfo = Common.NoHTML(txtInfo.Value.Trim()); comp.Fax = Common.NoHTML(txtFax.Value.Trim()); comp.Account = Common.NoHTML(txtAccount.Value.Trim()); comp.Address = Common.NoHTML(txtAddress.Value.Trim()); comp.IndID = txtIndusName.SelectedValue.ToInt(0); comp.Trade = txtIndusName.Items[txtIndusName.SelectedIndex].Text; comp.AuditState = 2; comp.AuditDate = DateTime.Now;//add by hgh 审核日期 comp.AuditUser = UserID.ToString(); comp.ts = DateTime.Now; comp.modifyuser = UserID; comp.OrganizationCode = Common.NoHTML(txtOrcode.Value.Trim()); comp.IsEnabled = rdEbleYes.Checked ? 1 : 0; comp.HotShow = rdHotShowYes.Checked ? 1 : 0; comp.FirstShow = Convert.ToInt32(ddlChkShow.SelectedValue);// rdFirstShowYes.Checked ? 1 : 0; comp.Remark = Common.NoHTML(txtRemark.Value.Trim()); comp.Erptype = ddlErptype.SelectedValue.ToInt(0); //企业编号 add by hgh comp.CompCode = Common.CreateCode(KeyID); if (HidFfileName.Value != "") { if (string.IsNullOrEmpty(comp.Attachment)) { comp.Attachment = HidFfileName.Value; } else { comp.Attachment += "," + HidFfileName.Value; } } List <Hi.Model.SYS_CompUser> ListComp = new Hi.BLL.SYS_CompUser().GetList("", " dr=0 and Ctype=1 and Utype=4 and CompID=" + KeyID + "", ""); if (ListComp.Count > 0) { Tran = DBUtility.SqlHelper.CreateStoreTranSaction(); Audit = ListComp[0].IsAudit == 2; if (Audit) { List <Hi.Model.BD_Distributor> dis = new Hi.BLL.BD_Distributor().GetList("", " isnull(dr,0)=0 and compid=" + KeyID + "", ""); foreach (Hi.Model.BD_Distributor model2 in dis) { model2.IsEnabled = comp.IsEnabled; model2.ts = DateTime.Now; model2.modifyuser = UserID; new Hi.BLL.BD_Distributor().Update(model2, Tran); } new Hi.BLL.BD_Company().Update(comp, Tran); List <Hi.Model.SYS_Users> user = new Hi.BLL.SYS_Users().GetList("", " isnull(dr,0)=0 and id=" + ListComp[0].UserID + " ", ""); if (user.Count > 0) { user[0].TrueName = Common.NoHTML(txtUserTrueName.Value.Trim()); user[0].ts = DateTime.Now; user[0].modifyuser = UserID; new Hi.BLL.SYS_Users().Update(user[0], Tran); } Tran.Commit(); Response.Redirect("CompInfo.aspx?go=1&KeyID=" + KeyID + "&type=5", false); } else { if (UserType == 3 || UserType == 4) { comp.OrgID = OrgID; comp.SalesManID = SalesManID; } if ((new Hi.BLL.BD_Company().Update(comp, Tran))) { //新增数据字典 Hi.Model.BD_DefDoc doc = new Hi.Model.BD_DefDoc(); doc.CompID = KeyID; doc.AtCode = ""; doc.AtName = "计量单位"; doc.ts = DateTime.Now; doc.modifyuser = UserID; doc.dr = 0; List <Hi.Model.BD_DefDoc> ll = new Hi.BLL.BD_DefDoc().GetList("", "isnull(dr,0)=0 and compid=" + KeyID + " and atname='计量单位'", "", Tran); if (ll.Count == 0) { new Hi.BLL.BD_DefDoc().Add(doc, Tran); } //代理商加盟是否需要审核 Hi.Model.SYS_SysName sysname = new Hi.Model.SYS_SysName(); sysname.CompID = KeyID; sysname.Code = ""; sysname.Name = "代理商加盟是否需要审核"; sysname.Value = "0"; sysname.ts = DateTime.Now; sysname.modifyuser = UserID; List <Hi.Model.SYS_SysName> sysl = new Hi.BLL.SYS_SysName().GetList("", "Name='代理商加盟是否需要审核' and CompID=" + KeyID, "", Tran); if (sysl != null && sysl.Count == 0) { new Hi.BLL.SYS_SysName().Add(sysname, Tran); } //费用科目 Hi.Model.BD_DefDoc doc1 = new Hi.Model.BD_DefDoc(); doc1.CompID = KeyID; doc1.AtCode = ""; doc1.AtName = "费用科目"; doc1.ts = DateTime.Now; doc1.modifyuser = UserID; doc1.dr = 0; List <Hi.Model.BD_DefDoc> ll1 = new Hi.BLL.BD_DefDoc().GetList("", "isnull(dr,0)=0 and compid=" + KeyID + " and atname='费用科目'", "", Tran); if (ll1.Count == 0) { new Hi.BLL.BD_DefDoc().Add(doc1, Tran); } doc.CompID = KeyID; doc.AtCode = ""; doc.AtName = "代理商等级"; doc.ts = DateTime.Now; doc.modifyuser = UserID; doc.dr = 0; List <Hi.Model.BD_DefDoc> lll = new Hi.BLL.BD_DefDoc().GetList("", "isnull(dr,0)=0 and compid=" + KeyID + " and atname='代理商等级'", "", Tran); if (lll.Count == 0) { new Hi.BLL.BD_DefDoc().Add(doc, Tran); } List <Hi.Model.SYS_Role> l = new Hi.BLL.SYS_Role().GetList("", "isnull(dr,0)=0 and isenabled=1 and compid=" + KeyID + " and RoleName='企业管理员'", ""); if (l.Count == 0) { //新增角色(企业管理员) Hi.Model.SYS_Role role = new Hi.Model.SYS_Role(); role.CompID = KeyID; role.RoleName = "企业管理员"; role.IsEnabled = 1; role.SortIndex = "1"; role.CreateDate = DateTime.Now; role.CreateUserID = UserID; role.ts = DateTime.Now; role.modifyuser = UserID; role.dr = 0; int Roid = new Hi.BLL.SYS_Role().Add(role, Tran); //新增角色用户 Hi.Model.SYS_RoleUser RoleUser = new Hi.Model.SYS_RoleUser(); RoleUser.FunType = 1; RoleUser.UserID = ListComp[0].UserID; RoleUser.RoleID = Roid; RoleUser.IsEnabled = true; RoleUser.CreateUser = this.UserID.ToString(); RoleUser.CreateDate = DateTime.Now; RoleUser.ts = DateTime.Now; RoleUser.dr = 0; new Hi.BLL.SYS_RoleUser().Add(RoleUser, Tran); //修改用户对应的角色 List <Hi.Model.SYS_Users> ListUser = new Hi.BLL.SYS_Users().GetList("", " isnull(dr,0)=0 and id=" + ListComp[0].UserID + " ", ""); if (ListUser.Count > 0) { ListUser[0].TrueName = Common.NoHTML(txtUserTrueName.Value.Trim()); ListUser[0].ts = DateTime.Now; ListUser[0].modifyuser = UserID; ListUser[0].AuditState = 2; new Hi.BLL.SYS_Users().Update(ListUser[0], Tran); } ListComp[0].IsAudit = 2; ListComp[0].modifyuser = UserID; ListComp[0].ts = DateTime.Now; ListComp[0].RoleID = Roid; new Hi.BLL.SYS_CompUser().Update(ListComp[0], Tran); Hi.Model.BD_CompNews CNew = new Hi.Model.BD_CompNews(); CNew.NewsTitle = "欢迎登录" + ConfigurationManager.AppSettings["PhoneSendName"].ToString() + "平台"; CNew.NewsContents = "”" + ConfigurationManager.AppSettings["PhoneSendName"].ToString() + "”平台为企业和代理商之间搭建了电子商务平台,通过企业入驻及代理商的加盟,形成覆盖全行业的线上销售网络。同时,充分利用平台信息化整合优势,帮助入驻企业销售模式电商化改造,以及为代理商信息化建设提供有力支持。另外,还将为供应链上的相关各方提供全渠道的结算服务以及授信融资等多项互联网金融服务。"; CNew.IsEnabled = 1; CNew.IsTop = 0; CNew.NewsType = 2; CNew.ShowType = "1,2"; CNew.CompID = KeyID; CNew.CreateDate = DateTime.Now; CNew.CreateUserID = UserID; CNew.ts = DateTime.Now; CNew.modifyuser = UserID; new Hi.BLL.BD_CompNews().Add(CNew, Tran); //新增角色权限表 Hi.Model.SYS_RoleSysFun rolesys = null; //add by hgh 增加了:and funcode<>'1030' List <Hi.Model.SYS_SysFun> funList = new Hi.BLL.SYS_SysFun().GetList("", " Type=1 and funcode<>'1030'", ""); foreach (Hi.Model.SYS_SysFun sys in funList) { rolesys = new Hi.Model.SYS_RoleSysFun(); rolesys.CompID = KeyID; rolesys.RoleID = Roid; rolesys.FunCode = sys.FunCode; rolesys.FunName = sys.FunName; rolesys.IsEnabled = 1; rolesys.CreateUserID = UserID; rolesys.CreateDate = DateTime.Now; rolesys.ts = DateTime.Now; rolesys.modifyuser = UserID; new Hi.BLL.SYS_RoleSysFun().Add(rolesys, Tran); } //新增代理商分类 Hi.Model.BD_DisType distype = new Hi.Model.BD_DisType(); distype.CompID = KeyID; distype.TypeName = "全部"; distype.ParentId = 0; distype.TypeCode = "1001"; distype.SortIndex = "1000"; distype.IsEnabled = 0; distype.CreateUserID = UserID; distype.CreateDate = DateTime.Now; distype.ts = DateTime.Now; distype.modifyuser = UserID; distype.dr = 0; new Hi.BLL.BD_DisType().Add(distype, Tran); Tran.Commit(); //审核成功 添加一条默认的商品分类 -开始 string Typecode = "";//商品大类 //Hi.Model.SYS_GType gtype = new Hi.BLL.SYS_GType().GetList(" top 1 *", " Deep=3 and FullCode like '"+ Typecode + "-%' and IsEnabled=1 and dr=0 ", " parentid,ID")[0]; //Hi.Model.BD_GoodsCategory DisType = new Hi.Model.BD_GoodsCategory(); //DisType.Code = NewCategoryCode("1"); //DisType.Deep = 1; //DisType.ParCode = ""; //DisType.ParentId = 0; //DisType.CompID = KeyID; //DisType.CategoryName = "默认"; //DisType.GoodsTypeID = gtype.ID; //DisType.SortIndex = "1000"; //DisType.CreateDate = DateTime.Now; //DisType.CreateUserID = 0; //DisType.IsEnabled = 1; //DisType.ts = DateTime.Now; //DisType.modifyuser = 0; //SqlTransaction trans = SqlHelper.CreateStoreTranSaction(); //try //{ // int countID = 0; // if ((countID = new Hi.BLL.BD_GoodsCategory().Add(DisType, trans)) > 0) // { // List<Hi.Model.BD_Goods> gList = new Hi.BLL.BD_Goods().GetList("", " CategoryID=''", ""); // if (gList != null && gList.Count > 0) // { // foreach (var bdGoodse in gList) // { // bdGoodse.CategoryID = countID; // new Hi.BLL.BD_Goods().Update(bdGoodse, trans); // } // } // trans.Commit(); // } //} //catch (Exception ex) //{ // Tiannuo.LogHelper.LogHelper.Error("Error", ex); // if (trans != null) // { // if (trans.Connection != null) // { // trans.Rollback(); // } // } // return; //} //finally //{ // SqlHelper.ConnectionClose(); // if (trans != null) // { // if (trans.Connection != null) // { // trans.Connection.Close(); // } // } //} //审核成功 添加一条默认的商品分类 -结束 DBUtility.GetPhoneCode getphonecode = new DBUtility.GetPhoneCode(); str = getphonecode.ReturnSTRS(ListUser[0].Phone, comp.CompName, ListUser[0].UserName); if (str != "Success") { JScript.AlertMsgMo(this, "审核通过的通知短信发送失败!请自行发送短信通知企业。", "function(){ window.location.href='CompInfo.aspx?go=1&KeyID=" + KeyID + "&type=" + Request.QueryString["type"] + "" + "'; }"); } else { JScript.AlertMsgMo(this, "审核成功", "function(){ window.location.href='CompInfo.aspx?go=1&KeyID=" + KeyID + "&type=5'; }"); } } else { ListComp[0].IsAudit = 2; ListComp[0].modifyuser = UserID; ListComp[0].ts = DateTime.Now; new Hi.BLL.SYS_CompUser().Update(ListComp[0], Tran); Hi.Model.SYS_Users user = null; List <Hi.Model.SYS_CompUser> User2 = new Hi.BLL.SYS_CompUser().GetList("", " dr=0 and utype=4 and CompID=" + KeyID + "", ""); if (User2.Count > 0) { user = new Hi.BLL.SYS_Users().GetModel(User2[0].UserID); } Tran.Commit(); // 发短信通知 DBUtility.GetPhoneCode getphonecode = new DBUtility.GetPhoneCode(); getphonecode.GetUser(ConfigurationManager.AppSettings["PhoneCodeAccount"].ToString(), ConfigurationManager.AppSettings["PhoneCodePwd"].ToString()); str = getphonecode.ReturnSTRS(user.Phone, comp.CompName, user.UserName); if (str != "Success") { JScript.AlertMsgMo(this, "审核通过的通知短信发送失败!请自行发送短信通知企业。", "function(){ window.location.href='CompInfo.aspx?go=1&KeyID=" + KeyID + "&type=" + Request.QueryString["type"] + "" + "'; }"); } else { JScript.AlertMsgMo(this, "审核成功", "function(){ window.location.href='CompInfo.aspx?go=1&KeyID=" + KeyID + "&type=5'; }"); } } } } } else { JScript.AlertMsg(this, "用户明细数据异常!。"); return; } } catch (Exception ex) { Tiannuo.LogHelper.LogHelper.Error("Error", ex); if (Tran != null) { if (Tran.Connection != null) { Tran.Rollback(); } } JScript.AlertMsgMo(this, "审核失败", "function(){ window.location.href=window.location.href; }"); } finally { DBUtility.SqlHelper.ConnectionClose(); } } else { JScript.AlertMsg(this, "厂商不存在!。"); return; } //cust by ggh 20180327 begin 审核通过时,默认给核心企业设置手续费 Settings(KeyID); //cust by ggh 20180327 end 审核通过时,默认给核心企业设置手续费 } else { if (Common.GetUserExists(txtUsername.Value.Trim())) { JScript.AlertMsg(this, "该登录帐号已存在。"); return; } if (Common.CompExistsAttribute("CompName", txtCompName.Value.Trim())) { JScript.AlertMsg(this, "该厂商名称已存在。"); return; } Regex Phonereg = new Regex("^0?1[0-9]{10}$"); if (!Phonereg.IsMatch(txtUserPhone.Value.Trim())) { JScript.AlertMsg(this, "手机号码格式错误!"); return; } if (Common.GetUserExists("Phone", txtUserPhone.Value.Trim())) { JScript.AlertMsg(this, "手机号码已被注册!"); return; } Hi.Model.BD_Company comp = new Hi.Model.BD_Company(); if (UserType == 3 || UserType == 4) { comp.OrgID = OrgID; comp.SalesManID = SalesManID; } comp.CompName = Common.NoHTML(txtCompName.Value.Trim()); comp.Capital = Capital.Value.Trim(); comp.CompType = Convert.ToInt32(CompType.SelectedValue); comp.Tel = Common.NoHTML(txtTel.Value.Trim()); if (txtPrincipal.Value.Trim() != "") { comp.Principal = Common.NoHTML(txtPrincipal.Value.Trim()); } else { comp.Principal = Common.NoHTML(txtUserTrueName.Value.Trim()); } comp.Legal = Common.NoHTML(txtLegal.Value.Trim()); comp.LegalTel = Common.NoHTML(txtLegalTel.Value.Trim()); if (txtPhone.Value.Trim() != "") { comp.Phone = Common.NoHTML(txtPhone.Value.Trim()); } else { comp.Phone = Common.NoHTML(txtUserPhone.Value.Trim()); } comp.ShortName = Common.NoHTML(txtShotName.Value.Trim()); comp.Zip = Common.NoHTML(txtZip.Value.Trim()); comp.Identitys = Common.NoHTML(txtIdentitys.Value.Trim()); comp.Licence = Common.NoHTML(txtLicence.Value.Trim()); comp.ManageInfo = Common.NoHTML(txtInfo.Value.Trim()); comp.Fax = Common.NoHTML(txtFax.Value.Trim()); comp.OrganizationCode = Common.NoHTML(txtOrcode.Value.Trim()); comp.Trade = txtIndusName.Items[txtIndusName.SelectedIndex].Text; comp.Account = Common.NoHTML(txtAccount.Value.Trim()); comp.Attachment = HidFfileName.Value; comp.Address = Common.NoHTML(txtAddress.Value.Trim()); comp.CustomCompinfo = "本公司产品种类丰富、质量优良、价格公道、服务周到。感谢您长期的支持与厚爱,您的满意是我们最高的追求,我们将竭诚为您提供优质、贴心的服务!"; string CompAddr = hidProvince.Value.Trim(); if (!string.IsNullOrWhiteSpace(hidCity.Value.Trim()) && hidCity.Value.Trim() != "选择市") { CompAddr += "-" + hidCity.Value.Trim(); } if (!string.IsNullOrWhiteSpace(hidArea.Value.Trim()) && hidArea.Value.Trim() != "选择区") { CompAddr += "-" + hidArea.Value.Trim(); } comp.CompAddr = CompAddr; comp.IndID = txtIndusName.SelectedValue.ToInt(0); comp.CreateDate = DateTime.Now; comp.CreateUserID = UserID; comp.ts = DateTime.Now; comp.modifyuser = UserID; comp.IsEnabled = rdEbleYes.Checked ? 1 : 0; comp.HotShow = rdHotShowYes.Checked ? 1 : 0; comp.FirstShow = Convert.ToInt32(ddlChkShow.SelectedValue);// rdFirstShowYes.Checked ? 1 : 0; comp.SortIndex = "001"; comp.Remark = Common.NoHTML(txtRemark.Value.Trim()); comp.Erptype = ddlErptype.SelectedValue.ToInt(0); comp.AuditState = 0; int comid = 0; SqlTransaction Tran = DBUtility.SqlHelper.CreateStoreTranSaction(); comid = new Hi.BLL.BD_Company().Add(comp, Tran); comp.CompCode = Common.CreateCode(comid); comp.ID = comid; new Hi.BLL.BD_Company().Update(comp, Tran); Hi.Model.SYS_Users user = new Hi.Model.SYS_Users(); user.UserName = Common.NoHTML(txtUsername.Value.Trim()); user.TrueName = Common.NoHTML(txtUserTrueName.Value.Trim()); user.UserPwd = Util.md5(txtUpwd.Text.Trim()); user.Phone = Common.NoHTML(txtUserPhone.Value.Trim()); user.AuditState = 2; user.IsEnabled = 1; user.AuditUser = UserID.ToString(); user.CreateUserID = UserID; user.CreateDate = DateTime.Now; user.ts = DateTime.Now; user.modifyuser = UserID; int userid = 0; userid = new Hi.BLL.SYS_Users().Add(user, Tran); Hi.Model.SYS_CompUser CompUser = new Hi.Model.SYS_CompUser(); CompUser.CompID = comid; CompUser.DisID = 0; CompUser.CreateDate = DateTime.Now; CompUser.CreateUserID = UserID; CompUser.modifyuser = UserID; CompUser.CType = 1; CompUser.UType = 4; CompUser.IsEnabled = 1; CompUser.IsAudit = 0; CompUser.ts = DateTime.Now; CompUser.dr = 0; CompUser.UserID = userid; new Hi.BLL.SYS_CompUser().Add(CompUser, Tran); Tran.Commit(); Response.Redirect("CompInfo.aspx?go=1&KeyID=" + comid, false); } }
/// <summary> /// 银行卡绑定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { //声明变量 string AccountName = string.Empty; string bankcode = string.Empty; string bankAddress = string.Empty; string bankPrivate = string.Empty; string bankCity = string.Empty; int Isno = 0; string remark = string.Empty; string county = string.Empty; //开会所在区县 int BankId = 0; //银行Id int type = 0; //账户类型 //收集数据 AccountName = Common.NoHTML(this.txtDisUser.Value.Trim());//账户名称 bankcode = Common.NoHTML(this.txtbankcode.Value.Replace(" ", "")); bankAddress = Common.NoHTML(this.txtbankAddress.Value.Trim()); bankPrivate = Common.NoHTML(this.hidProvince.Value.Trim()); bankCity = Common.NoHTML(this.hidCity.Value.Trim()); county = Common.NoHTML(this.hidArea.Value.Trim()); Isno = Convert.ToInt32(this.chkIsno.Checked == true ? 1 : 0); int is_no = Convert.ToInt32(this.hid_isno.Value); if (is_no == 1) { int success = new Hi.BLL.PAY_PrePayment().Upisno(); } remark = Common.NoHTML(this.txtRemark.Value.Trim()); BankId = Convert.ToInt32(this.ddlbank.Value); type = Convert.ToInt32(this.ddltype.Value); //实例化对象实体 Hi.Model.SYS_PaymentBank pbModel = new Hi.Model.SYS_PaymentBank(); // Paid = Convert.ToInt32(Request.QueryString["paid"]); //pbModel.paymentAccountID = Paid; pbModel.BankID = BankId; pbModel.AccountName = AccountName; pbModel.bankcode = bankcode; pbModel.bankAddress = bankAddress; pbModel.bankPrivate = bankPrivate; pbModel.bankCity = bankCity; pbModel.Isno = Isno; pbModel.Remark = remark; pbModel.CreateDate = DateTime.Now; pbModel.CreateUser = UserID; pbModel.dr = 0; pbModel.modifyuser = UserID; pbModel.ts = DateTime.Now; pbModel.vdef1 = county; pbModel.Start = 1; // pbModel.vdef4 = Common.NoHTML(this.txtphone.InnerText); // pbModel.vdef5 = Common.NoHTML(this.txtphpcode.Value); pbModel.type = type; pbModel.vdef2 = Common.NoHTML(this.SltPesontype.Value); pbModel.vdef3 = Common.NoHTML(this.txtpesoncode.Value); if (KeyID > 0) { pbModel.ID = KeyID; bool result = new Hi.BLL.SYS_PaymentBank().Update(pbModel); if (result) { //判断平台是否有默认账户 List <Hi.Model.SYS_PaymentBank> Sysl = new Hi.BLL.SYS_PaymentBank().GetList("", " Isno=1", ""); int num = Sysl.Count; if (num == 0) { JScript.AlertMsg(this, "平台最好有一个,默认第一收款账户,请检查!", "PaybankInfo.aspx?paid=" + Paid + "&KeyID=" + KeyID); } else { Response.Redirect("PaybankInfo.aspx?paid=" + Paid + "&KeyID=" + KeyID); } } } else { int succes = new Hi.BLL.SYS_PaymentBank().Add(pbModel); if (succes > 0)//银行账户保存成功后,进行绑定代理商操作 { //判断平台是否有默认账户 List <Hi.Model.SYS_PaymentBank> Sysl = new Hi.BLL.SYS_PaymentBank().GetList("", " Isno=1", ""); int num = Sysl.Count; if (num == 0) { JScript.AlertMsg(this, "平台最好有一个,默认第一收款账户,请检查!", "PaybankInfo.aspx?paid=" + Paid + "&KeyID=" + succes); } else { Response.Redirect("PaybankInfo.aspx?paid=" + Paid + "&KeyID=" + succes); } } } }
public void btnAddList_Click(object sender, EventArgs e) { string path = ""; int count = 0; int index = 0; SqlTransaction Tran = null; try { if (FileUpload1.HasFile == false)//HasFile用来检查FileUpload是否有指定文件 { JScript.AlertMsg(this, "请您选择Excel文件", ""); return; //当无文件时,返回 } string IsXls = System.IO.Path.GetExtension(FileUpload1.FileName).ToString().ToLower(); //System.IO.Path.GetExtension获得文件的扩展名 if (IsXls != ".xls" && IsXls != ".xlsx") { JScript.AlertMsg(this, "只可以选择Excel文件", ""); return;//当选择的不是Excel文件时,返回 } if (!Directory.Exists(Server.MapPath("TemplateFile"))) { Directory.CreateDirectory(Server.MapPath("TemplateFile")); } string filename = FileUpload1.FileName; string name = filename.Replace(IsXls, ""); path = Server.MapPath("TemplateFile/") + name + "-" + DateTime.Now.ToString("yyyyMMddhhmmssffff") + IsXls; FileUpload1.SaveAs(path); DataTable dt = Common.ExcelToDataTable(path, TitleIndex); if (dt == null) { throw new Exception("Excel表中无数据"); } if (dt.Rows.Count == 0) { throw new Exception("Excel表中无数据"); } string Discode = string.Empty; string DisName = string.Empty; string DisUserName = string.Empty; string DisAddrees = string.Empty; string DisPerson = string.Empty; string DisPhone = string.Empty; string DisRemark = string.Empty; string Provice = string.Empty; string City = string.Empty; string Area = string.Empty; DataRow[] rows = dt.Select(); Tran = DBUtility.SqlHelper.CreateStoreTranSaction(); Eroor = false; TitleError = string.Empty; foreach (DataRow row in rows) { try { if (row["代理商(代理商)名称 *\n(2-20个汉字或字母,推荐使用中文名称)"].ToString().Trim() == "" && row["管理员姓名 *\n(请填写真实姓名,以便更好地为您服务)"].ToString().Trim() == "" && row["详细地址 *\n(常用收货地址)"].ToString().Trim() == "") { break; } index++; if (row["代理商(代理商)名称 *\n(2-20个汉字或字母,推荐使用中文名称)"].ToString().Trim() == "示例代理商名称1" || row["代理商(代理商)名称 *\n(2-20个汉字或字母,推荐使用中文名称)"].ToString().Trim() == "示例代理商名称2" || row["代理商(代理商)名称 *\n(2-20个汉字或字母,推荐使用中文名称)"].ToString().Trim() == "示例代理商名称3") { continue; } DisName = DisExistsAttribute("DisName", CheckDisLen(CheckVal(row["代理商(代理商)名称 *\n(2-20个汉字或字母,推荐使用中文名称)"].ToString().Trim(), "代理商(代理商)名称", index), index), "代理商(代理商)名称", index, Tran); DisPerson = CheckVal(row["管理员姓名 *\n(请填写真实姓名,以便更好地为您服务)"].ToString().Trim(), "管理员姓名", index); DisUserName = UserExistsAttribute("username", CheckVal(row["管理员登录帐号 *\n(2-20个文字、字母、数字,可以录入代理商姓名、简称等,一经设定无法更改,将来可用手机号进行登录)"].ToString().Trim(), "管理员登录帐号", index), "管理员登录帐号", index, Tran); DisPhone = CheckPhone(CheckVal(row["管理员手机 *\n(登录、发送验证短信)"].ToString().Trim(), "管理员手机", index), "管理员手机", index, Tran); Provice = CheckVal(row["所在省*"].ToString().Trim(), "省", index); City = CheckVal(row["所在市*"].ToString().Trim(), "市", index); if (City.IndexOf("_") > 0) { City = City.Substring(City.IndexOf("_") + 1, City.Length - City.IndexOf("_") - 1); } Area = CheckVal(row["所在区*"].ToString().Trim(), "区", index); DisAddrees = CheckVal(row["详细地址 *\n(常用收货地址)"].ToString().Trim(), "详细地址(常用收货地址)", index); DisRemark = row["备注"].ToString().Trim(); } catch (Exception ex) { if (ex is ApplicationException) { Eroor = true; TitleError += ex.Message; continue; } else { throw new Exception("代理商Excel模版格式错误,请重新下载模版填入数据后导入。"); } } Hi.Model.BD_Distributor Dis = new Hi.Model.BD_Distributor(); //Dis.DisCode = Discode; Dis.CompID = CompID; Dis.DisName = DisName; Dis.Province = Provice; Dis.City = City; Dis.Area = Area; Dis.Address = DisAddrees; Dis.Principal = DisPerson; Dis.Phone = DisPhone; Dis.Remark = DisRemark; Dis.IsCheck = 0; Dis.CreditType = 0; //不可以赊销 Dis.Paypwd = Util.md5("123456"); Dis.IsEnabled = 1; Dis.AuditState = 2; Dis.CreateDate = DateTime.Now; Dis.CreateUserID = UserID; Dis.ts = DateTime.Now; Dis.modifyuser = UserID; int disid = 0; if ((disid = new Hi.BLL.BD_Distributor().Add(Dis, Tran)) > 0) { List <Hi.Model.SYS_Role> l = new Hi.BLL.SYS_Role().GetList("", "isnull(dr,0)=0 and isenabled=1 and DisID=" + disid + " and RoleName='企业管理员'", "", Tran); if (l.Count == 0) { //新增角色(企业管理员) Hi.Model.SYS_Role role = new Hi.Model.SYS_Role(); role.CompID = CompID; role.DisID = disid; role.RoleName = "企业管理员"; role.IsEnabled = 1; role.SortIndex = "1"; role.CreateDate = DateTime.Now; role.CreateUserID = UserID; role.ts = DateTime.Now; role.modifyuser = UserID; role.dr = 0; int Roid = new Hi.BLL.SYS_Role().Add(role, Tran); //新增管理员用户和角色 Hi.Model.SYS_Users user = new Hi.Model.SYS_Users(); user.Type = 5; user.DisID = disid; user.CompID = CompID; user.UserName = DisUserName; user.Phone = DisPhone; user.TrueName = DisPerson; user.UserPwd = Util.md5("123456"); user.IsEnabled = 1; user.AuditState = 2; user.RoleID = Roid; user.CreateDate = DateTime.Now; user.CreateUserID = UserID; user.ts = DateTime.Now; user.modifyuser = UserID; new Hi.BLL.SYS_Users().Add(user, Tran); //新增角色权限表 在审核通过时会加 } Hi.Model.BD_DisAddr addr = new Hi.Model.BD_DisAddr(); addr.Province = Provice; addr.City = City; addr.Area = Area; addr.DisID = disid; addr.Principal = DisPerson; addr.Phone = DisPhone; addr.Address = Provice + City + Area + DisAddrees; addr.IsDefault = 1; addr.ts = DateTime.Now; addr.CreateDate = DateTime.Now; addr.CreateUserID = UserID; addr.modifyuser = UserID; new Hi.BLL.BD_DisAddr().Add(addr, Tran); } else { throw new ApplicationException("导入失败,服务器异常请重试。"); } count++; } if (!Eroor) { Tran.Commit(); if (Request["nextstep"] + "" == "1") { JScript.AlertMsgMo(this, "导入成功,共导入" + count + "条代理商", "function(){ $(window.parent.leftFrame.document).find('.menuson li.active').removeClass('active');window.parent.leftFrame.document.getElementById('ktxzjxs').className = 'active'; window.location.href='DisList.aspx?nextstep=1'; }"); } else { JScript.AlertMsgMo(this, "导入成功,共导入" + count + "条代理商", "function(){ $(window.parent.leftFrame.document).find('.menuson .lista1 div.al').removeClass('active');window.parent.leftFrame.document.getElementById('jxsxxwh').className = 'al active'; window.location.href='DisList.aspx'; }"); } } else { Tran.Rollback(); JScript.AlertMsgMo(this, TitleError, "function(){ $('a.bulk').trigger('click'); }"); } } catch (Exception ex) { if (Tran != null) { if (Tran.Connection != null) { Tran.Rollback(); } } JScript.AlertMsgMo(this, ex.Message, "function(){ $('a.bulk').trigger('click'); }"); } finally { if (!string.IsNullOrEmpty(path)) { if (File.Exists(path)) { File.Delete(path); } } } }
protected void btnAdd_Click(object sender, EventArgs e) { Hi.Model.SYS_Industry industry = null; if (string.IsNullOrEmpty(txtInduName.Value.Trim())) { JScript.AlertMsg(this, "行业分类名称不能为空!"); return; } if (KeyID != 0) { industry = new Hi.BLL.SYS_Industry().GetModel(KeyID); industry.InduName = Common.NoHTML(txtInduName.Value.Trim()); industry.SortIndex = Common.NoHTML(txtSort.Value.Trim()); if (this.rdoStatus1.Checked) { industry.IsEnabled = 0; } else { industry.IsEnabled = 1; } industry.InduCode = "0"; industry.ts = DateTime.Now; industry.modifyuser = UserID; if (new Hi.BLL.SYS_Industry().Update(industry)) { //JScript.AlertMsgMo(this, "操作成功", "function(){ window.location.href='IndustryInfo.aspx?KeyID=" + KeyID + "'; }"); Response.Redirect("IndustryInfo.aspx?KeyID=" + KeyID); } } else { industry = new Hi.Model.SYS_Industry(); industry.InduName = Common.NoHTML(txtInduName.Value.Trim()); industry.SortIndex = Common.NoHTML(txtSort.Value.Trim()); if (this.rdoStatus1.Checked) { industry.IsEnabled = 0; } else { industry.IsEnabled = 1; } //标准参数 industry.CreateDate = DateTime.Now; industry.CreateUserID = UserID; industry.ts = DateTime.Now; industry.modifyuser = UserID; int newuserid = 0; newuserid = new Hi.BLL.SYS_Industry().Add(industry); if (newuserid > 0) { Response.Redirect("IndustryInfo.aspx?KeyID=" + newuserid); } } }
protected void btnAdd_Click(object sender, EventArgs e) { if (KeyID > 0) { Hi.Model.BD_Org org = new Hi.BLL.BD_Org().GetModel(KeyID); if (org != null) { if (Common.OrgExistsAttribute("OrgName", txtOrgName.Value.Trim(), KeyID.ToString())) { JScript.AlertMsg(this, "该机构名称已存在。"); return; } org.OrgName = Common.NoHTML(txtOrgName.Value.Trim()); org.Principal = Common.NoHTML(txtPrincipal.Value.Trim()); org.Phone = Common.NoHTML(txtPhone.Value.Trim()); org.IsEnabled = rdEbleYes.Checked ? 1 : 0; org.SortIndex = Common.NoHTML(txtSortIndex.Value.Trim()); org.Remark = Common.NoHTML(txtRemark.Value.Trim()); org.ts = DateTime.Now; org.modifyuser = UserID; if (new Hi.BLL.BD_Org().Update(org)) { List <Hi.Model.SYS_AdminUser> user = new Hi.BLL.SYS_AdminUser().GetList("", " isnull(dr,0)=0 and orgid='" + KeyID + "' and usertype in(3)", ""); if (user.Count > 0) { if (user[0].LoginPwd != txtUpwd.Text.Trim()) { user[0].LoginPwd = Util.md5(txtUpwd.Text.Trim()); } user[0].TrueName = Common.NoHTML(txtUserTrueName.Value.Trim()); user[0].IsEnabled = rdEbleYes.Checked ? 1 : 0; user[0].ts = DateTime.Now; user[0].modifyuser = UserID; new Hi.BLL.SYS_AdminUser().Update(user[0]); Response.Redirect("OrgInfo.aspx?KeyID=" + KeyID + "&type=2&page=1"); } else { Hi.Model.SYS_AdminUser userModel = new Hi.Model.SYS_AdminUser(); userModel.OrgID = KeyID; userModel.UserType = 3; userModel.IsEnabled = rdEbleYes.Checked ? 1 : 0; userModel.LoginName = Common.NoHTML(txtUsername.Value.Trim()); userModel.LoginPwd = Util.md5(txtUpwd.Text.Trim()); userModel.Phone = Common.NoHTML(txtUserPhone.Value.Trim()); userModel.TrueName = Common.NoHTML(txtUserTrueName.Value.Trim()); userModel.CreateDate = DateTime.Now; userModel.CreateUserID = UserID; userModel.ts = DateTime.Now; userModel.modifyuser = UserID; if (new Hi.BLL.SYS_AdminUser().Add(userModel) > 0) { Response.Redirect("OrgInfo.aspx?KeyID=" + KeyID + "&type=2&page=1"); } else { new Hi.BLL.BD_Org().Delete(KeyID); } } } } } else { if (Common.OrgExistsAttribute("OrgName", txtOrgName.Value.Trim())) { JScript.AlertMsg(this, "该机构名称已存在。"); return; } if (Common.SysUserExistsAttribute("LoginName", txtUsername.Value.Trim())) { JScript.AlertMsg(this, "该登录帐号已存在。"); return; } Hi.Model.BD_Org org = new Hi.Model.BD_Org(); org.OrgName = Common.NoHTML(txtOrgName.Value.Trim()); org.Principal = Common.NoHTML(txtPrincipal.Value.Trim()); org.Phone = Common.NoHTML(txtPhone.Value.Trim()); org.IsEnabled = rdEbleYes.Checked ? 1 : 0; org.SortIndex = Common.NoHTML(txtSortIndex.Value.Trim()); org.Remark = Common.NoHTML(txtRemark.Value.Trim()); org.ts = DateTime.Now; org.modifyuser = UserID; int Orgid = 0; if ((Orgid = new Hi.BLL.BD_Org().Add(org)) > 0) { Hi.Model.SYS_AdminUser user = new Hi.Model.SYS_AdminUser(); user.OrgID = Orgid; user.UserType = 3; user.IsEnabled = rdEbleYes.Checked ? 1 : 0; user.LoginName = Common.NoHTML(txtUsername.Value.Trim()); user.LoginPwd = Util.md5(txtUpwd.Text.Trim()); user.Phone = Common.NoHTML(txtUserPhone.Value.Trim()); user.TrueName = Common.NoHTML(txtUserTrueName.Value.Trim()); user.CreateDate = DateTime.Now; user.CreateUserID = UserID; user.ts = DateTime.Now; user.modifyuser = UserID; if (new Hi.BLL.SYS_AdminUser().Add(user) > 0) { Response.Redirect("OrgInfo.aspx?KeyID=" + Orgid + "&type=2&page=1"); } else { new Hi.BLL.BD_Org().Delete(Orgid); } } } }