/// <summary> /// 保存新增 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSvAdd_Click(object sender, EventArgs e) { try { this.PKID.Value = CSA.Text.Util.getNewGuid(); CSA.DAL.SQLBuilder builder = new SQLBuilder(); builder.TblName = TblName; builder.AutoSetInfo(divDtls); builder.AddData(PKField, this.PKID.Value); builder.setAddUserInfo(BLL.User.AdminUser.UserID); builder.setModUserInfo(BLL.User.AdminUser.UserID); builder.AddData("type", "SMS"); if (builder.AutoInsert()) { // //在这里实现发送短信功能 // BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value, "添加", ControlHelper.getControlContent(divDtls, null)); bindData(); InitField(ControlHelper.CEnum.CANCEL); JscriptMsg("添加操作成功", "", "Success"); } else { JscriptMsg("添加失败!", "", "Error"); } } catch (Exception ex) { JscriptMsg(ex.Message, "", "Error"); } }
protected void btnSvEdit_Click(object sender, EventArgs e) { try { SQLBuilder builder = new SQLBuilder(TblName); builder.Where = " and 1=1"; builder.AutoSetInfo(divDtls); builder.AddData("moduser", BLL.User.AdminUser.UserID); builder.AddData("ModTime", DateTime.Now.ToString("s")); if (builder.AutoUpdate()) { bindData(); BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value, "修改", ControlHelper.getControlContent(divDtls, null)); JscriptMsg("修改操作成功!", "", "Success"); } else { JscriptMsg("修改操作失败!", "", "Error"); } } catch (Exception ex) { JscriptMsg("修改失败!" + ex.Message.Replace("\r\n", ""), "", "Error"); } }
/// <summary> /// 保存新增 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSvAdd_Click(object sender, EventArgs e) { try { this.PKID.Value = CSA.Text.Util.getNewGuid(); CSA.DAL.SQLBuilder builder = new SQLBuilder(); builder.TblName = TblName; builder.AutoSetInfo(divDtls); builder.AddData("pkid", this.PKID.Value); builder.AddData("ModUser", BLL.User.AdminUser.UserID); builder.AddData("ModTime", DateTime.Now.ToString()); List <string> lst = new List <string>(); lst.Add(builder.InsertSql); //设置权限 saveRoleCtrl(ref lst); if (DBAccess.ExecuteSqlTran(lst) > 0) { bindData(); BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value, "添加", ControlHelper.getControlContent(divDtls, null)); InitField(ControlHelper.CEnum.CANCEL); JscriptMsg("添加操作成功", "", "Success"); } else { JscriptMsg("添加失败!", "", "Error"); } } catch (Exception ex) { JscriptMsg(ex.Message, "", "Error"); } }
/// <summary> /// 保存新增 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSvAdd_Click(object sender, EventArgs e) { try { this.PKID.Value = CSA.Text.Util.getNewGuid(); CSA.DAL.SQLBuilder builder = new SQLBuilder(); builder.TblName = TblName; builder.AutoSetInfo(divDtls); builder.AddData(PKField, this.PKID.Value); string casetype = getViewState("casetype"); if (!string.IsNullOrEmpty(casetype)) { builder.AddData("type", casetype); } builder.setAddUserInfo(BLL.User.AdminUser.UserID); builder.setModUserInfo(BLL.User.AdminUser.UserID); if (builder.AutoInsert()) { BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value, "添加", ControlHelper.getControlContent(divDtls, null)); JscriptMsg("添加操作成功", "", "Success"); Response.Redirect(getLinkWidthBaseParas("BsProducts.aspx", new string[] { "type=del", "casetype=" + getViewState("casetype") })); } else { JscriptMsg("添加失败!", "", "Error"); } } catch (Exception ex) { JscriptMsg(ex.Message, "", "Error"); } }
/// <summary> /// 保存修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSvEdit_Click(object sender, EventArgs e) { try { CSA.DAL.SQLBuilder builder = new SQLBuilder(); builder.TblName = TblName; builder.AutoSetInfo(divDtls); builder.Where = " and pkid='" + PKID.Value + "'"; builder.AddData("ModUser", BLL.User.AdminUser.UserID); builder.AddData("ModTime", DateTime.Now.ToString()); List <string> lst = new List <string>(); lst.Add(builder.UpdateSql); //设置权限 saveRoleCtrl(ref lst); if (DBAccess.ExecuteSqlTran(lst) > 0) { bindData(); BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value, "修改", ControlHelper.getControlContent(divDtls, null)); InitField(ControlHelper.CEnum.CANCEL); JscriptMsg("修改操作成功!", "", "Success"); } else { JscriptMsg("修改操作失败!", "", "Error"); } } catch (Exception ex) { JscriptMsg("修改失败!" + ex.Message.Replace("\r\n", ""), "", "Error"); } }
/// <summary> /// 保存修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSvEdit_Click(object sender, EventArgs e) { try { CSA.DAL.SQLBuilder builder = new SQLBuilder(); builder.TblName = TblName; builder.AutoSetInfo(divDtls); if (this.KK_status.SelectedValue == "0108") { builder.AddData("isEnd", 1); } else { builder.AddData("isEnd", 0); } builder.Where = string.Format(" and {0}='{1}'", PKField, PKID.Value); builder.setModUserInfo(BLL.User.AdminUser.UserID); if (builder.AutoUpdate()) { BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value, "修改", ControlHelper.getControlContent(divDtls, null)); JscriptMsg("修改操作成功!", "", "Success"); } else { JscriptMsg("修改操作失败!", "", "Error"); } } catch (Exception ex) { JscriptMsg("修改失败!" + ex.Message.Replace("\r\n", ""), "", "Error"); } }
/// <summary> /// 添加操作日志 /// </summary> /// <param name="menuid">菜单ID</param> /// <param name="tblName">操作表名</param> /// <param name="pkid">主键</param> /// <param name="type">操作类型,如添加,删除,修改,批量操作</param> /// <param name="notes">备注</param> public static void AddLog(string menuid, string menuName, string tblName, string pkid, string type, string notes) { SQLBuilder builder = new SQLBuilder("Sy_Log"); builder.AddData("uid", BLL.User.AdminUser.UserID); builder.AddData("username", BLL.User.AdminUser.getLoginName()); ////通过 menuid 获取当前操作页内容 //if (!string.IsNullOrEmpty(pkid)) //{ // builder.AddData("menuID", menuid); // object menu = CSA.DAL.DBAccess.ExecuteScalar( // "select name from sy_menu where pkid='" + menuid + "'"); // if(menu!=null) // builder.AddData("menu",menu.ToString()); //} builder.AddData("menu", menuName); builder.AddData("tblName", tblName); if (!string.IsNullOrEmpty(pkid)) { builder.AddData("pkid", pkid); } builder.AddData("ip", CSA.HC.Common.getIP()); builder.AddData("type", type); builder.AddData("time", DateTime.Now.ToString()); builder.AddData("notes", notes); builder.AutoInsert(); }
/// <summary> /// 保存新增 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSvAdd_Click(object sender, EventArgs e) { try { this.PKID.Value = CSA.Text.Util.getNewGuid(); CSA.DAL.SQLBuilder builder = new SQLBuilder(); builder.TblName = TblName; builder.AutoSetInfo(divDtls); builder.AddData(PKField, this.PKID.Value); builder.AddData("Photos", focus_photo.Value); builder.setAddUserInfo(BLL.User.AdminUser.UserID); builder.setModUserInfo(BLL.User.AdminUser.UserID); List <string> lst = new List <string>(); lst.Add(builder.InsertSql); #region 保存相册========== string[] albumArr = Request.Form.GetValues("hide_photo_name"); string[] remarkArr = Request.Form.GetValues("hide_photo_remark"); if (albumArr != null && albumArr.Length > 0) { for (int i = 0; i < albumArr.Length; i++) { string[] imgArr = albumArr[i].Split('|'); if (imgArr.Length == 3) { string remark = ""; if (!string.IsNullOrEmpty(remarkArr[i])) { remark = remarkArr[i]; } string sql = string.Format("insert into Bs_NewsAlbums(new_pkid,big_img,small_img,remark,type) values ('{0}','{1}','{2}','{3}','product')", this.PKID.Value, imgArr[1], imgArr[2], remark); lst.Add(sql); } } } #endregion if (CSA.DAL.DBAccess.ExecuteSqlTran(lst) > 0) { BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value, "添加", ControlHelper.getControlContent(divDtls, null)); JscriptMsg("添加操作成功", "", "Success"); Response.Redirect(getLinkWidthBaseParas("BsProducts.aspx", "type", "del")); } else { JscriptMsg("添加失败!", "", "Error"); } } catch (Exception ex) { JscriptMsg(ex.Message, "", "Error"); } }
protected void btnReply_Click(object sender, EventArgs e) { SQLBuilder builder = new SQLBuilder("Bs_OrdersMsg"); builder.AddData("notes", this.KK3_Notes.Value); builder.setAddUserInfo(BLL.User.AdminUser.UserID); builder.AddData("Bs_OrdersCode", this.PKID.Value); if (builder.AutoInsert()) { BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, "Bs_Orders", PKID.Value, "添加订单备注", "添加订单处理信息:" + this.KK3_Notes.Value); bindOrderMsg(); } }
/// <summary> /// 保存修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSvEdit_Click(object sender, EventArgs e) { try { CSA.DAL.SQLBuilder builder = new SQLBuilder(); builder.TblName = TblName; builder.AutoSetInfo(divDtls); builder.Where = string.Format(" and {0}='{1}'", PKField, PKID.Value); if (KK_Reply.Value.Trim() != "") { builder.AddData("isReply", "1"); } if (builder.AutoUpdate()) { BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value, "修改", ControlHelper.getControlContent(divDtls, null)); bindData(); InitField(ControlHelper.CEnum.CANCEL); JscriptMsg("修改操作成功!", "", "Success"); } else { JscriptMsg("修改操作失败!", "", "Error"); } } catch (Exception ex) { JscriptMsg("修改失败!" + ex.Message.Replace("\r\n", ""), "", "Error"); } }
/// <summary> /// 保存修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSvEdit_Click(object sender, EventArgs e) { try { CSA.DAL.SQLBuilder builder = new SQLBuilder(); builder.TblName = TblName; builder.AutoSetInfo(divDtls); builder.Where = string.Format(" and {0}='{1}'", PKField, PKID.Value); builder.setModUserInfo(BLL.User.AdminUser.UserID); string K_password = this.K_password.Value; if (K_password.Length > 0) { builder.AddData("password", CSA.Security.Encrypt.getMD5(K_password)); } if (builder.AutoUpdate()) { BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value, "修改", ControlHelper.getControlContent(divDtls, null)); bindData(); InitField(ControlHelper.CEnum.CANCEL); JscriptMsg("修改操作成功!", "", "Success"); } else { JscriptMsg("修改操作失败!", "", "Error"); } } catch (Exception ex) { JscriptMsg("修改失败!" + ex.Message.Replace("\r\n", ""), "", "Error"); } }
/// <summary> /// 保存新增 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSvAdd_Click(object sender, EventArgs e) { try { this.PKID.Value = CSA.Text.Util.getNewGuid(); CSA.DAL.SQLBuilder builder = new SQLBuilder(); builder.TblName = TblName; builder.AutoSetInfo(divDtls); // builder.AddData(PKField, this.PKID.Value); builder.setAddUserInfo(BLL.User.AdminUser.UserID); builder.setModUserInfo(BLL.User.AdminUser.UserID); string K_password = this.K_password.Value; if (K_password.Length > 0) { builder.AddData("password", CSA.Security.Encrypt.getMD5(K_password)); } if (builder.AutoInsert()) { //SendEmailToUser(this.KK_Name.Value, this.K_password.Value,this.KK_Email.Value); BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value, "添加", ControlHelper.getControlContent(divDtls, null)); bindData(); InitField(ControlHelper.CEnum.CANCEL); JscriptMsg("添加操作成功", "", "Success"); } else { JscriptMsg("添加失败!", "", "Error"); } } catch (Exception ex) { JscriptMsg(ex.Message, "", "Error"); } }
/// <summary> /// 保存权限设置 /// </summary> /// <param name="lst"></param> private void saveRoleCtrl(ref List <string> lst) { lst.Add("delete from Sy_RoleCtrl where Sy_RolePKID='" + PKID.Value + "'"); CSA.DAL.SQLBuilder builder = new SQLBuilder(); foreach (ListItem li in chkControlList.Items) { if (li.Selected) { builder.Clear(); builder.TblName = "SY_RoleCtrl"; builder.AddData("Sy_ControlPKID", li.Value); builder.AddData("Sy_RolePKID", PKID.Value); lst.Add(builder.InsertSql); } } }
/// <summary> /// 保存修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSvEdit_Click(object sender, EventArgs e) { try { CSA.DAL.SQLBuilder builder = new SQLBuilder(); builder.TblName = TblName; builder.AutoSetInfo(divDtls); builder.Where = string.Format(" and {0}='{1}'", PKField, PKID.Value); builder.setModUserInfo(BLL.User.AdminUser.UserID); string pwd = this.Password.Value; if (!string.IsNullOrEmpty(pwd)) { builder.AddData("Password", CSA.Security.Encrypt.getMD5(pwd)); } List <string> lst = new List <string>(); lst.Add(builder.UpdateSql); if (DBAccess.ExecuteSqlTran(lst) > 0) { BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value, "修改", ControlHelper.getControlContent(divDtls, null)); JscriptMsg("修改操作成功!", "", "Success"); } else { JscriptMsg("修改操作失败!", "", "Error"); } } catch (Exception ex) { JscriptMsg("修改失败!" + ex.Message.Replace("\r\n", ""), "", "Error"); } }
/// <summary> /// 保存修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSvEdit_Click(object sender, EventArgs e) { try { CSA.DAL.SQLBuilder builder = new SQLBuilder(); builder.TblName = TblName; builder.AutoSetInfo(divDtls); builder.Where = string.Format(" and {0}='{1}'", PKField, PKID.Value); builder.setModUserInfo(BLL.User.AdminUser.UserID); builder.AddData("ModTime", DateTime.Now.ToString("s")); if (builder.AutoUpdate()) { BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value, "修改", ControlHelper.getControlContent(divDtls, null)); bindData(); JscriptMsg("修改操作成功!", "", "Success"); //如果是单篇文章的修改,则修改完不改变当前控件状态 string pkid = getViewState("pkid"); if (string.IsNullOrEmpty(pkid)) { InitField(ControlHelper.CEnum.CANCEL); } } else { JscriptMsg("修改操作失败!", "", "Error"); } } catch (Exception ex) { JscriptMsg("修改失败!" + ex.Message.Replace("\r\n", ""), "", "Error"); } }
/// <summary> /// 保存新增 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSvAdd_Click(object sender, EventArgs e) { try { string pid = ""; string pcode = getViewState("pcode"); if (pcode != "") { pid = DBAccess.ExecuteScalar("select pkid from " + TblName + " where code='" + pcode + "'").ToString(); } this.PKID.Value = CSA.Text.Util.getNewGuid(); CSA.DAL.SQLBuilder builder = new SQLBuilder(); builder.TblName = TblName; builder.AutoSetInfo(divDtls); builder.AddData("pkid", this.PKID.Value); builder.setAddUserInfo(BLL.User.AdminUser.UserID); builder.setModUserInfo(BLL.User.AdminUser.UserID); if (!string.IsNullOrEmpty(pid)) builder.AddData("parentID", pid); if (builder.AutoInsert()) { bindData(); BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value, "添加", ControlHelper.getControlContent(divDtls, null)); InitField(ControlHelper.CEnum.CANCEL); JscriptMsg("添加操作成功", "", "Success"); } else { JscriptMsg("添加失败!", "", "Error"); } } catch (Exception ex) { JscriptMsg(ex.Message, "", "Error"); } }
/// <summary> /// 保存权限设置 /// </summary> /// <param name="lst"></param> private void saveUserRole(ref List <string> lst) { lst.Add("delete from SY_UserRole where Sy_UserFK='" + PKID.Value + "'"); string moduser = BLL.User.AdminUser.UserID; SQLBuilder builder = new SQLBuilder(); foreach (ListItem li in chkRoleList.Items) { if (li.Selected) { builder.Clear(); builder.TblName = "SY_UserRole"; builder.AddData("PKID", CSA.Text.Util.getNewGuid()); builder.AddData("Sy_RoleFK", li.Value); builder.AddData("Sy_UserFK", PKID.Value); builder.AddData("ModUser", moduser); builder.AddData("ModTime", DateTime.Now.ToString()); lst.Add(builder.InsertSql); } } }
/// <summary> /// 保存新增 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSvAdd_Click(object sender, EventArgs e) { try { this.PKID.Value = CSA.Text.Util.getNewGuid(); CSA.DAL.SQLBuilder builder = new SQLBuilder(); builder.TblName = TblName; builder.AutoSetInfo(divDtls); builder.AddData(PKField, this.PKID.Value); builder.setAddUserInfo(BLL.User.AdminUser.UserID); builder.setModUserInfo(BLL.User.AdminUser.UserID); string pwd = this.Password.Value; if (!string.IsNullOrEmpty(pwd)) { builder.AddData("Password", CSA.Security.Encrypt.getMD5(pwd)); } List <string> lst = new List <string>(); lst.Add(builder.InsertSql); //设置权限 saveUserRole(ref lst); if (DBAccess.ExecuteSqlTran(lst) > 0) { BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value, "添加", ControlHelper.getControlContent(divDtls, null)); bindData(); InitField(ControlHelper.CEnum.CANCEL); JscriptMsg("添加操作成功", "", "Success"); } else { JscriptMsg("添加失败!", "", "Error"); } } catch (Exception ex) { JscriptMsg(ex.Message, "", "Error"); } }
/// <summary> /// 保存新增 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSvAdd_Click(object sender, EventArgs e) { try { this.PKID.Value = CSA.Text.Util.getNewGuid(); CSA.DAL.SQLBuilder builder = new SQLBuilder(); builder.TblName = TblName; builder.AutoSetInfo(divDtls); builder.AddData(PKField, this.PKID.Value); builder.setAddUserInfo(BLL.User.AdminUser.UserID); builder.setModUserInfo(BLL.User.AdminUser.UserID); builder.AddData(FKField, getViewState("pcode")); builder.AddData("AddTime", DateTime.Now); if (builder.AutoInsert()) { BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value, "添加", ControlHelper.getControlContent(divDtls, null)); bindData(); JscriptMsg("添加操作成功", "", "Success"); //Response.Write(builder.InsertSql); //如果是单篇文章的修改,则修改完不改变当前控件状态 string pkid = getViewState("pkid"); if (string.IsNullOrEmpty(pkid)) { InitField(ControlHelper.CEnum.CANCEL); } } else { JscriptMsg("添加失败!", "", "Error"); } } catch (Exception ex) { JscriptMsg(ex.Message, "", "Error"); } }
protected void btnAddPro_Click(object sender, EventArgs e) { SQLBuilder builder = new SQLBuilder("Bs_OrdersDtl"); builder.DataFlag = "KK2_"; builder.setAddUserInfo(BLL.User.AdminUser.UserID); builder.AutoSetInfo(divProAdd); builder.AddData("Bs_OrdersCode", this.PKID.Value); if (builder.AutoInsert()) { BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, "Bs_Orders", PKID.Value, "添加订单产品", ControlHelper.getControlContent(divProAdd, null)); bindOrderPro(); } }
/// <summary> /// 保存新增 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSvAdd_Click(object sender, EventArgs e) { try { this.PKID.Value = CSA.Text.Util.getNewGuid(); CSA.DAL.SQLBuilder builder = new SQLBuilder(); builder.TblName = TblName; builder.AutoSetInfo(divDtls); builder.AddData(PKField, this.PKID.Value); builder.setAddUserInfo(BLL.User.AdminUser.UserID); builder.setModUserInfo(BLL.User.AdminUser.UserID); builder.AddData("type", "EMAIL"); if (builder.AutoInsert()) { CSA.Net.Email mail = new CSA.Net.Email(); mail.Title = this.KK_Title.Value.Trim(); mail.Content = this.KK_Content.Value; mail.MailTo = this.KK_Receiver.Value.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); mail.Send(); BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value, "添加", ControlHelper.getControlContent(divDtls, null)); bindData(); InitField(ControlHelper.CEnum.CANCEL); JscriptMsg("添加操作成功", "", "Success"); } else { JscriptMsg("添加失败!", "", "Error"); } } catch (Exception ex) { JscriptMsg(ex.Message, "", "Error"); } }
protected void Page_Load(object sender, EventArgs e) { string action = Com.Util.getStringByObject(Request["action"]); string Get_Authcode = ""; string Sys_Authcode = ""; DataTable dt; SQLBuilder builder = new CSA.DAL.SQLBuilder(); SQLBuilder builder2 = new CSA.DAL.SQLBuilder(); switch (action) { case "addMsg": if (Request.Form["checkcode"].ToString().ToLower() == Session[Common.HNKeys.SESSION_CODE].ToString().ToLower()) { builder = new CSA.DAL.SQLBuilder("Bs_Msg"); builder.AddData("IP", CSA.HC.Common.getIP()); builder.AddData("Name", Com.Util.getStringByObject(Request.Form["name"])); builder.AddData("Email", Com.Util.getStringByObject(Request.Form["email"])); builder.AddData("Phone", Com.Util.getStringByObject(Request.Form["phone"])); builder.AddData("Company", Com.Util.getStringByObject(Request.Form["company"])); builder.AddData("Content", Com.Util.getStringByObject(Request.Form["content"])); builder.AddData("addtime", DateTime.Now.ToString("s")); builder.AddData("Sy_CodeMT", "0101"); if (builder.AutoInsert()) { Response.Write("{\"status\":\"success\",\"content\":\"提交成功!\"}"); } else { Response.Write("{\"status\":\"error\",\"content\":\"提交失败!\"}"); } } else { Response.Write("{\"status\":\"error\",\"content\":\"验证码错误!\"}"); } break; #region ========= out 登出 case "logout": Factory.getUserBllInstance().logout(); Response.Write("{\"status\":\"success\",\"content\":\"退出成功!\"}"); break; #endregion #region ========= log 登陆 case "log": //登陆 Get_Authcode = Com.Util.getStringByObject(Request.Form["checkcode"]).ToLower(); Sys_Authcode = Com.Util.getStringByObject(Session[Common.HNKeys.SESSION_CODE]).ToLower(); string login_name = Com.Util.getStringByObject(Request.Form["mobile"]); string login_pwd = Com.Util.getStringByObject(Request.Form["password"]); if (Get_Authcode == Sys_Authcode) { if (login_name == "" || login_name == "") { Response.Write("{\"status\":\"error\",\"content\":\"读取登陆信息失败,请重新登陆!\"}"); } else { if (CurInfo.CurUser != null) { Factory.getUserBllInstance().logout(); } Bs_User user = new Bs_User(); user.Mobile = login_name; user.Password = login_pwd; user.Bs_UserGradeCode = "01"; Factory.getUserBllInstance().login(user); if (CurInfo.CurUser == null) { Response.Write("{\"status\":\"error\",\"content\":\"账号或密码错误!\"}"); } else { Response.Write("{\"status\":\"success\",\"content\":\"登陆成功!\"}"); } } } else { Response.Write("{\"status\":\"error\",\"content\":\"验证码错误!\"}"); return; } break; #endregion #region ========= reg 注册 case "reg": //注册 Get_Authcode = Com.Util.getStringByObject(Request.Form["msgcode"]).ToLower(); string Name = Com.Util.getStringByObject(Request.Form["mobile"]); string Pwd = Com.Util.getStringByObject(Request.Form["password"]); try { if (Name == "" || Pwd == "" || Get_Authcode == "") { Response.Write("{\"status\":\"error\",\"content\":\"参数不能为空\"}"); } else { StringBuilder sqlStr = new StringBuilder(); //sqlStr.Append(string.Format("select top 1 MsCode from Bs_SMSCode where mobile='{0}' and DateDiff (minute,AddTime,'{1}')<=0 order by AddTime desc;", Name, DateTime.Now.AddMinutes(-20))); sqlStr.Append(string.Format("select id from Bs_User where mobile='{0}' and Bs_UserGradeCode='{1}'", Name, "01")); DataSet ds = CSA.DAL.DBAccess.getDS(sqlStr.ToString()); //DataTable dt1 = ds.Tables[0]; DataTable dt2 = ds.Tables[0]; //if (dt1.Rows.Count > 0 && Com.Util.getStringByObject(dt1.Rows[0]["MsCode"]) == Get_Authcode) //{ if (dt2.Rows.Count <= 0) { AutoNo ano = new AutoNo(); builder = new SQLBuilder("Bs_User"); builder.AddData("AddTime", DateTime.Now.ToString("s")); builder.AddData("code", "CC" + ano.autoNo()); builder.AddData("name", "User_" + ano.autoNo()); builder.AddData("levelname", "User_" + ano.GenerateRandom(2) + new Random().Next(0, 9999)); builder.AddData("pkid", CSA.Text.Util.getNewGuid()); builder.AddData("mobile", Name); builder.AddData("password", CSA.Security.Encrypt.getMD5(Pwd)); builder.AddData("Bs_UserGradeCode", "01"); builder.AddData("status", 1); if (builder.AutoInsert()) { //DBAccess.ExecuteNonQuery(string.Format("delete Bs_SMSCode where mobile='{0}'", Name)); Bs_User user = new Bs_User(); user.Mobile = Name; user.Password = Pwd; user.Bs_UserGradeCode = "01"; Factory.getUserBllInstance().login(user); if (CurInfo.CurUser != null) { Response.Write("{\"status\":\"success\",\"content\":\"注册成功\"}"); } else { Response.Write("{\"status\":\"error\",\"content\":\"获取用户信息失败!\"}"); } } else { Response.Write("{\"status\":\"error\",\"content\":\"注册失败\"}"); } } else { Response.Write("{\"status\":\"error\",\"content\":\"该手机号码已被注册!\"}"); } //} //else // Response.Write("{\"status\":\"error\",\"content\":\"验证码错误或失效!\"}"); } } catch (Exception ex) { Response.Write("{\"status\":\"error\",\"content\":\"" + ex.ToString() + "\"}"); } break; #endregion #region ========= pwd 忘记密码 case "pwd": //忘记密码 Get_Authcode = Com.Util.getStringByObject(Request.Form["authcode"]).ToLower(); string p_Name = Com.Util.getStringByObject(Request.Form["username"]); string p_Pwd = Com.Util.getStringByObject(Request.Form["pwd"]); if (Session["msg_code"] != null) { if (Get_Authcode == Session["msg_code"].ToString()) { if (p_Name != "" && p_Pwd != "") { Bs_User user = new Bs_User(); string sql = "select * from Bs_User where Name='" + p_Name + "'"; dt = CSA.DAL.DBAccess.getRS(sql); if (dt.Rows.Count > 0) { Factory.getUserBllInstance().EditPwd(CSA.Security.Encrypt.getMD5(p_Pwd), Convert.ToInt32(dt.Rows[0]["ID"])); Factory.getUserBllInstance().logout(); //SendMsg(p_Name, "安全提示:您的密码在" + DateTime.Now + "时被修改,如非本人操作,请联系管理处。【实体店导购】"); Response.Write("{\"status\":\"success\",\"content\":\"修改成功,请使用新密码登陆!\"}"); } else { Response.Write("{\"status\":\"error\",\"content\":\"找不到该用户!\"}"); } } else { Response.Write("{\"status\":\"error\",\"content\":\"读取信息失败!\"}"); } } else { Response.Write("{\"status\":\"error\",\"content\":\"验证码错误!\"}"); } } else { Response.Write("{\"status\":\"error\",\"content\":\"读取验证码失败!\"}"); } break; #endregion #region ========= editor_pwd 修改密码 case "editor_pwd": //修改密码 if (CurInfo.CurUser != null) { Get_Authcode = Com.Util.getStringByObject(Request.Form["authcode"]).ToLower(); string old_Pwd = Com.Util.getStringByObject(Request.Form["o_pwd"]); string new_Pwd = Com.Util.getStringByObject(Request.Form["n_pwd"]); if (Session[Common.HNKeys.SESSION_CODE] != null) { if (Get_Authcode == Session[Common.HNKeys.SESSION_CODE].ToString().ToLower()) { if (old_Pwd != "" && new_Pwd != "") { Bs_User user = new Bs_User(); string sql = "select id from Bs_User where id=" + CurInfo.CurUser.ID + " and Password='******'"; dt = CSA.DAL.DBAccess.getRS(sql); if (dt.Rows.Count > 0) { Factory.getUserBllInstance().EditPwd(CSA.Security.Encrypt.getMD5(new_Pwd), Convert.ToInt32(dt.Rows[0]["ID"])); Factory.getUserBllInstance().logout(); Response.Write("{\"status\":\"success\",\"content\":\"修改成功,请重新登陆!\"}"); } else { Response.Write("{\"status\":\"error\",\"content\":\"用户名或密码错误!\"}"); } } else { Response.Write("{\"status\":\"error\",\"content\":\"读取信息失败!\"}"); } } else { Response.Write("{\"status\":\"error\",\"content\":\"验证码错误!\"}"); } } else { Response.Write("{\"status\":\"error\",\"content\":\"读取验证码失败!\"}"); } } else { Response.Write("{\"status\":\"error\",\"content\":\"登陆信息已失效,请重新登陆!\"}"); } break; #endregion #region ========= editor_info 修改个人信息 case "editor_info": //修改个人信息 if (CurInfo.CurUser != null) { string info_name = Com.Util.getStringByObject(Request.Form["name"]); string info_sex = Com.Util.getStringByObject(Request.Form["sex"]); string info_email = Com.Util.getStringByObject(Request.Form["email"]); string info_address = Com.Util.getStringByObject(Request.Form["address"]); builder = new CSA.DAL.SQLBuilder("Bs_User"); builder.AddData("realname", info_name); builder.AddData("sex", info_sex); builder.AddData("email", info_email); builder.AddData("address", info_address); builder.Where = string.Format(" and {0}={1}", "id", CurInfo.CurUser.ID); if (builder.AutoUpdate()) { Bs_UserDao dao = new Bs_UserDao(); Bs_User user = dao.getUserByID(CurInfo.CurUser.ID); if (user != null) { CurInfo.CurUser = user; } Response.Write("{\"status\":\"success\",\"content\":\"修改个人信息成功!\"}"); } else { Response.Write("{\"status\":\"error\",\"content\":\"修改个人信息失败!\"}"); } } else { Response.Write("{\"status\":\"error\",\"content\":\"参数错误!\"}"); } break; #endregion } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { switch (Request["action"]) { case "save": //设置权限 try { string pkids = Request["para1"]; //role ids pkid = Request["pkid"]; //delete old RoleMnu set sqlList.Add(string.Format("DELETE FROM Sy_RoleMnu WHERE Sy_RoleFK = '{0}'", pkid)); //insert new RoleMnu SQLBuilder builder = new SQLBuilder(TblName); pkids = pkids.Replace("root", ""); foreach (string _pkid in pkids.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)) { builder.Clear(); builder.TblName = TblName; builder.AddData("ModUser", BLL.User.AdminUser.UserID); builder.AddData("ModTime", DateTime.Now.ToString()); builder.AddData("Sy_RoleFK", pkid); builder.AddData("Sy_MenuFK", _pkid.Trim()); sqlList.Add(builder.InsertSql); } DBAccess.ExecuteSqlTran(sqlList); msg = "权限已成功更新到服务器!"; } catch (Exception ex) { msg = "保存到服务器时出现错误!" + ex.Message; } finally { sqlList = null; } break; default: //读取菜单 string node = Request["node"]; //id pkid = Request["pkid"]; type = Request["type"]; // 分类,root string chk = Request["chk"]; string role = Request["role"]; //过滤node不是PKID时 if (node.Equals(type)) { node = ""; } if ("1".Equals(chk)) { ChkBoxParas = "cls: 'folder',checked:false,"; } else { ChkBoxParas = ""; } msg = getSyMenu(node.Replace("root", ""), role); break; } Response.Write(msg);//Comm.getMsgForJson(pkids)); Response.End(); } } catch (Exception ex) { // WriteEnd("初始数据出错!" + ex.Message); } }
/// <summary> /// 保存修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSvEdit_Click(object sender, EventArgs e) { string idList = ""; try { CSA.DAL.SQLBuilder builder = new SQLBuilder(); builder.TblName = TblName; builder.AutoSetInfo(divDtls); builder.AddData("Photos", focus_photo.Value); builder.Where = string.Format(" and {0}='{1}'", PKField, PKID.Value); builder.setModUserInfo(BLL.User.AdminUser.UserID); List <string> lst = new List <string>(); lst.Add(builder.UpdateSql); #region 保存相册========== string[] albumArr = Request.Form.GetValues("hide_photo_name"); string[] remarkArr = Request.Form.GetValues("hide_photo_remark"); if (albumArr != null && albumArr.Length > 0) { for (int i = 0; i < albumArr.Length; i++) { string[] imgArr = albumArr[i].Split('|'); int img_id = int.Parse(imgArr[0]); idList += img_id + ","; if (imgArr.Length == 3) { string remark = ""; if (!string.IsNullOrEmpty(remarkArr[i])) { remark = remarkArr[i]; } //图片id存在---修改 否则 添加 if (img_id > 0) { string sql = string.Format("update Bs_NewsAlbums set new_pkid='{0}',big_img='{1}',small_img='{2}',remark='{3}' where id={4}", this.PKID.Value, imgArr[1], imgArr[2], remark, img_id); lst.Add(sql); } else { string sql = string.Format("insert into Bs_NewsAlbums(new_pkid,big_img,small_img,remark,type) values ('{0}','{1}','{2}','{3}','product')", this.PKID.Value, imgArr[1], imgArr[2], remark); lst.Add(sql); } } } } //删除已删除的图片 new Bs_NewsAlbumsDao().DeleteList(idList, PKID.Value); #endregion if (CSA.DAL.DBAccess.ExecuteSqlTran(lst) > 0) { BLL.Sys.AdminLog.AddLog(Request.QueryString["mid"], Header.Title, TblName, PKID.Value, "修改", ControlHelper.getControlContent(divDtls, null)); //JscriptMsg("修改操作成功!", "", "Success"); Response.Write("<script language='javascript'>alert('修改操作成功');location.href='" + Request.Url.ToString() + "'</script>"); } else { Response.Write("<script language='javascript'>alert('修改操作失败');location.href='" + Request.Url.ToString() + "'</script>"); //JscriptMsg("修改操作失败!", "", "Error"); } } catch (Exception ex) { JscriptMsg("修改失败!" + ex.Message.Replace("\r\n", ""), "", "Error"); } }