public ActionResult View(int id) { var hasAccess = AuthorizationManager.HasAccess("InstagramContract.View"); if (!hasAccess) { throw new Exception("شما مجاز به انجام این عملیات نیستید"); } var total = 0; LogManagement.Logging($"View InstagramContract id:{id}", (int)LogType.Info, "View InstagramContract", "InstagramContractController/ViewAction"); var model = InstagramContractService.GetInstance().GetDefaultQuery(new InstagramContractSearchObject(), new List <Navigations> { Navigations.person, Navigations.City }, out total) .Where(w => w.Id == id).FirstOrDefault(); var planDpService = PlanDurationPriceService.GetInstance(); var planTypeService = PlanTypeService.GetInstance(); model.InstagramContractPlans.ToList().ForEach(item => { var ptId = planDpService.GetEntity(item.PlanDurationPriceId).PlanTypeId; item.PlanTitle = planTypeService.GetEntity(ptId).PlanTitle; }); return(View(model)); }
protected void Button1_Click(object sender, EventArgs e) { UploadIMG m_upload = new UploadIMG(); m_upload.Path = @"..\MainSite\WebResources\ArticleImg\"; m_upload.IsThumbnail = false; try { if (m_upload.UpLoadIMG(FileUpload1)) { Image1.ImageUrl = AppConfig.WebResourcesPath() + "ArticleImg/" + m_upload.OFileName; Image1.Visible = true; TextBox1.Text = AppConfig.WebResourcesPath() + "ArticleImg/" + m_upload.OFileName; TextBox1.Visible = true; } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "photook", "alert('" + m_upload.MSG + "');", true); } } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "WebForMain.Userphoto.Upload", Request.UserHostAddress); Page.ClientScript.RegisterStartupScript(this.GetType(), "photook", "alert('系统故障,请联系管理员');", true); } }
/// <summary> /// 编辑信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button3_Click(object sender, EventArgs e) { #region 检查输入 if (RadioButtonList1.SelectedIndex == -1) { Page.ClientScript.RegisterStartupScript(this.GetType(), "nogender", "alert('请选择性别');", true); return; } #endregion try { m_user = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"])); m_user.FateType = int.Parse(drpFateType.SelectedValue); m_user.Gender = int.Parse(RadioButtonList1.SelectedValue); m_user.Birth = DatePicker2.SelectedTime; m_user.IsShowBirth = int.Parse(drpBirthType.SelectedValue); m_user.HomeTown = District2.Area3SysNo; m_user.Intro = txtIntro.Text; USR_CustomerBll.GetInstance().Update(m_user); SessionInfo m_session = new SessionInfo(); m_session.CustomerEntity = m_user; m_session.GradeEntity = USR_GradeBll.GetInstance().GetModel(m_user.SysNo); Session[AppConfig.CustomerSession] = m_session; Page.ClientScript.RegisterStartupScript(this.GetType(), "infook", "alert('用户信息更新成功');", true); } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "WebForMain.UserInfo.Edit", Request.UserHostAddress); Page.ClientScript.RegisterStartupScript(this.GetType(), "noinfo", "alert('系统故障,请联系管理员');", true); } }
//The required initialization of domain application is peformed //inside this code, what we meant by intiailization is configuring //the services and assigning its reference back to domain application. public DomainApp CreateApplication(AppInfo appInfo, DomainApp serverApp) { DomainApp newApp = new DomainApp(appInfo); LogManagement logMgmt = new LogManagement(this, newApp); return(newApp); }
/// <summary> /// 执行SQL语句返回是否有记录(SQL语句必须过滤参数) /// </summary> /// <param name="CommandText"></param> /// <returns></returns> public bool CmdtoHasRow(string CommandText) { bool ret = false; try { m_cmd.CommandText = CommandText; m_conn.Open(); SqlDataReader m_dr = m_cmd.ExecuteReader(); m_dr.Read(); if (m_dr.HasRows) { ret = false; } else { ret = true; } m_dr.Close(); } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "SQLData,相关SQL语句:" + CommandText, HttpContext.Current.Request.RawUrl + " | " + HttpContext.Current.Request.UserHostAddress); } finally { m_conn.Close(); } return(ret); }
protected void Button7_Click(object sender, EventArgs e) { string OPath = @"~\WebResources\UpUserFiles\Photos\O"; try { int imageWidth = Int32.Parse(txt_width.Text); int imageHeight = Int32.Parse(txt_height.Text); int cutTop = Int32.Parse(txt_top.Text); int cutLeft = Int32.Parse(txt_left.Text); int dropWidth = Int32.Parse(txt_DropWidth.Text); int dropHeight = Int32.Parse(txt_DropHeight.Text); string filename = ImageHelper.SaveCutPic(Server.MapPath(@"~\WebResources\UpUserFiles\Photos\Tmp\o" + hdfPicID.Value), Server.MapPath(OPath), 0, 0, dropWidth, dropHeight, cutLeft, cutTop, imageWidth, imageHeight); ImageHelper.SaveThumbnail(Server.MapPath(OPath + @"\" + filename), Server.MapPath(@"~\WebResources\UpUserFiles\Photos\T"), filename, 70, 70, true); m_user = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"])); m_user.Photo = filename.Replace(".jpg", ""); USR_CustomerBll.GetInstance().Update(m_user); MultiView1.ActiveViewIndex = 0; //DataBind(); Page.ClientScript.RegisterStartupScript(this.GetType(), "photook", "alert('头像更新成功');", true); } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "WebForMain.Userphoto.Upload", Request.UserHostAddress); Page.ClientScript.RegisterStartupScript(this.GetType(), "photook", "alert('系统故障,请联系管理员');", true); } }
/// <summary> /// 执行存储过程返回DataRow /// </summary> /// <param name="StoredProcedure"></param> /// <returns></returns> public DataRow SPtoDataRow(string StoredProcedure) { DataTable ret = new DataTable(); try { SqlParameter retpara = m_cmd.Parameters.Add("@reValue", SqlDbType.Int); retpara.Direction = ParameterDirection.ReturnValue; m_cmd.CommandText = StoredProcedure; m_cmd.CommandType = CommandType.StoredProcedure; m_conn.Open(); SqlDataAdapter m_adpt = new SqlDataAdapter(m_cmd); m_adpt.Fill(ret); ReturnValue = m_cmd.Parameters["@reValue"].Value.ToString(); } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "SQLData,相关SP:" + StoredProcedure, HttpContext.Current.Request.RawUrl + " | " + HttpContext.Current.Request.UserHostAddress); } finally { m_conn.Close(); } return(ret.Rows[0]); }
public ActionResult Submit(InstagramContract entity) { var modeTitle = entity.Id != 0 ? $"Update InstagramContract id:{entity.Id}" : "Create InstagramContract"; LogManagement.Logging($"modeTitle", (int)LogType.Info, "Create/Update InstagramContract", "InstagramContractController/SubmitAction"); var errorMessage = ""; //var x = entity.Password; if (entity.ContractDate != null) { entity.ContractDate = Utility.ConvertToPersian(entity.ContractDate.ToString()); } //entity.ContractDate = DateTime.Now; //if (entity.FromDate != null) // entity.FromDate = Utility.ConvertToPersian(entity.FromDate.ToString()); //if (entity.ToDate != null) // entity.ToDate = Utility.ConvertToPersian(entity.ToDate.ToString()); var contractService = InstagramContractService.GetInstance(); try { contractService.Save(entity); } catch (Exception e) { errorMessage = e.Message; } return(Json(errorMessage, JsonRequestBehavior.AllowGet)); //message }
/// <summary> /// 执行存储过程返回是否有记录 /// </summary> /// <param name="StoredProcedure"></param> /// <returns></returns> public bool SPtoHasRow(string StoredProcedure) { bool ret = false; try { SqlParameter retpara = m_cmd.Parameters.Add("@reValue", SqlDbType.Int); retpara.Direction = ParameterDirection.ReturnValue; m_cmd.CommandText = StoredProcedure; m_cmd.CommandType = CommandType.StoredProcedure; m_conn.Open(); SqlDataReader m_dr = m_cmd.ExecuteReader(); m_dr.Read(); if (m_dr.HasRows) { ret = false; } else { ret = true; } ReturnValue = m_cmd.Parameters["@reValue"].Value.ToString(); m_dr.Close(); } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "SQLData,相关SP:" + StoredProcedure, HttpContext.Current.Request.RawUrl + " | " + HttpContext.Current.Request.UserHostAddress); } finally { m_conn.Close(); } return(ret); }
protected void Unnamed3_Click(object sender, EventArgs e) { SYS_AdminMod m_supplier = new SYS_AdminMod(); if (type == "EDIT") { if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { SysNo = int.Parse(Request.QueryString["id"]); } m_supplier = SYS_AdminBll.GetInstance().GetModel(SysNo); } if (txtUserName.Text.Trim() == "") { ltrError.Text = "请填写用户登录名!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true); return; } if (txtPass.Text.Trim() == "" && type == "ADD") { ltrError.Text = "请输入初始密码!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true); return; } m_supplier.CustomerSysNo = int.Parse(Request.QueryString["user"]); m_supplier.Username = txtUserName.Text; try { if (type == "ADD") { m_supplier.DR = 0; m_supplier.Password = txtPass.Text; m_supplier.TS = DateTime.Now; m_supplier.LastLogin = DateTime.Now; m_supplier.SysNo = SYS_AdminBll.GetInstance().Add(m_supplier); SetPrivilege(m_supplier.SysNo); LogManagement.getInstance().WriteTrace(m_supplier.SysNo, "Article.Add", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username); } else if (type == "EDIT") { if (txtPass.Text.Trim() != "加密存储") { m_supplier.Password = txtPass.Text; } SYS_AdminBll.GetInstance().Update(m_supplier); SetPrivilege(m_supplier.SysNo); LogManagement.getInstance().WriteTrace(m_supplier.SysNo, "Article.Edit", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username); } ltrNotice.Text = "该记录已保存成功!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true); } catch (Exception ex) { ltrError.Text = "系统错误,保存失败!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true); LogManagement.getInstance().WriteException(ex, "Article.Save", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["ID"] != null && Request.QueryString["ID"] != "") { try { //生成图片 AstroMod mod = new AstroMod(); mod.graphicID = Request.QueryString["ID"]; if (Request.QueryString["fa"] != "") { mod.composeFile1 = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\" + Request.QueryString["fa"]; } if (Request.QueryString["fb"] != "") { mod.composeFile2 = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\" + Request.QueryString["fb"]; } AstroBiz.GetInstance().GetGraphic(mod); //输出 CreateImageOnPage(AstroBiz.GetInstance().GetGraphicPath(mod.graphicID), HttpContext.Current); } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "星盘显示", Request.UserHostAddress); } } }
protected void Unnamed1_Click(object sender, EventArgs e) { SYS_DistrictMod m_area = new SYS_DistrictMod(); if (type == "EDIT") { if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { SysNo = int.Parse(Request.QueryString["id"]); } m_area = SYS_DistrictBll.GetInstance().GetModel(SysNo); } try { m_area.Name = txtName.Text.Trim(); m_area.EnglishName = txtEnglishName.Text.Trim(); m_area.DR = int.Parse(drpStatus.SelectedValue); SYS_DistrictBll.GetInstance().Update(m_area); LogManagement.getInstance().WriteTrace(m_area.SysNo, "District.Update", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username); ltrNotice.Text = "该记录已保存成功!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true); } catch { ltrError.Text = "输入资料格式有误,请检查!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true); return; } }
/// <summary> /// 上传头像 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { UploadIMG m_upload = new UploadIMG(); m_upload.Path = @"WebResources\UpUserFiles\Photos\Tmp"; m_upload.IsThumbnail = false; try { if (m_upload.UpLoadIMG(FileUpload1)) { ImageDrag.ImageUrl = "~/ControlLibrary/ShowPhoto.aspx?type=tmp&id=" + m_upload.OFileName.Replace("o", ""); ImageIcon.ImageUrl = "~/ControlLibrary/ShowPhoto.aspx?type=tmp&id=" + m_upload.OFileName.Replace("o", ""); hdfPicID.Value = m_upload.OFileName.Replace("o", ""); MultiView1.ActiveViewIndex = 4; } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "photook", "alert('" + m_upload.MSG + "');", true); } } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "WebForMain.Userphoto.Upload", Request.UserHostAddress); Page.ClientScript.RegisterStartupScript(this.GetType(), "photook", "alert('系统故障,请联系管理员');", true); } }
/// <summary> /// 修改密码 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button5_Click(object sender, EventArgs e) { if (txtOldPass.Text.Trim() == "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('请输入旧密码');", true); return; } if (txtNewPass.Text.Trim() == "" || txtPassAgain.Text.Trim() == "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('新的密码不能为空');", true); return; } if (txtNewPass.Text.Trim().Length < 6 || txtNewPass.Text.Trim().Length > 16) { Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('密码长度必须在6-16字符内!');", true); return; } if (txtPassAgain.Text.Trim() != txtPassAgain.Text.Trim()) { Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('密码输入不一致!');", true); return; } if (txtOldPass.Text.Trim() != GetSession().CustomerEntity.Password) { Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('您输入的旧密码与原密码不一致,请重新输入!');", true); return; } if (CommonTools.CheckPasswordLevel(txtNewPass.Text.Trim()) == 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('您的密码实在太过简单,请重新输入!');", true); return; } else { try { //更新数据库中的用户密码 m_user = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"])); m_user.Password = txtNewPass.Text.Trim(); USR_CustomerBll.GetInstance().Update(m_user); //更新session中的密码 SessionInfo m_session = new SessionInfo(); m_session.CustomerEntity = m_user; m_session.GradeEntity = USR_GradeBll.GetInstance().GetModel(m_user.SysNo); Session[AppConfig.CustomerSession] = m_session; Page.ClientScript.RegisterStartupScript(this.GetType(), "passok", "alert('修改成功');", true); } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "WebForMain.UserPass.Edit", Request.UserHostAddress); Page.ClientScript.RegisterStartupScript(this.GetType(), "nopass", "alert('系统故障,请联系管理员');", true); } } }
protected void Unnamed1_Click(object sender, EventArgs e) { CMS_CategoryMod m_cate = new CMS_CategoryMod(); if (type == "EDIT") { if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { SysNo = int.Parse(Request.QueryString["id"]); } m_cate = CMS_CategoryBll.GetInstance().GetModel(SysNo); try { m_cate.Name = txtName.Text.Trim(); m_cate.IsHide = int.Parse(drpHide.SelectedValue); m_cate.DR = int.Parse(drpStatus.SelectedValue); CMS_CategoryBll.GetInstance().Update(m_cate); LogManagement.getInstance().WriteTrace(m_cate.SysNo, "CMS.Category.Update", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username); ltrNotice.Text = "该记录已保存成功!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true); } catch { ltrError.Text = "输入资料格式有误,请检查!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true); return; } } else if (type == "ADD") { try { m_cate.Name = txtName.Text.Trim(); m_cate.IsHide = int.Parse(drpHide.SelectedValue); m_cate.DR = int.Parse(drpStatus.SelectedValue); m_cate.TS = DateTime.Now; m_cate.ParentSysNo = Convert.ToInt32(ViewState["parent"]); m_cate.TopSysNo = CMS_CategoryBll.GetInstance().GetModel(Convert.ToInt32(ViewState["parent"])).TopSysNo; CMS_CategoryBll.GetInstance().Add(m_cate); LogManagement.getInstance().WriteTrace(m_cate.SysNo, "CMS.Category.Add", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username); ltrNotice.Text = "该记录已保存成功!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true); } catch { ltrError.Text = "输入资料格式有误,请检查!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true); return; } } }
public ActionResult Search(int?pageNumber = 1) { var searchObject = new CustomerSearchObject { }; LogManagement.Logging($"Search Customers from list", (int)LogType.Info, "Search Customers", "CustomersController/SearchAction"); var data = GetAllCustomers(searchObject); return(Json(data, JsonRequestBehavior.AllowGet)); //message }
public ActionResult Search(int?pageNumber = 1) { var searchObject = new InstagramContractSearchObject { }; LogManagement.Logging($"Search InstagramContract from list", (int)LogType.Info, "Search InstagramContract", "InstagramContractController/SearchAction"); var data = GetAllContracts(searchObject); return(Json(data, JsonRequestBehavior.AllowGet)); //message }
protected void Unnamed1_Click(object sender, EventArgs e) { if (ValidateCode() && ValidateEmail()) { try { //生成6位随机新密码,并MD5加密; string[] arr = ("A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,T,U,V,W,X,Y,Z,2,3,4,5,6,7,8,9").Split(','); string Password = ""; int randValue = -1; Random rand = new Random(unchecked ((int)DateTime.Now.Ticks)); for (int i = 0; i < 6; i++) { randValue = rand.Next(0, arr.Length - 1); Password += arr[randValue]; } m_user.Password = Password; USR_CustomerBll.GetInstance().Update(m_user); //TCPMail oMail = new TCPMail(); //string url = "http://www.diafans.com/Login/LoginSuccess.aspx?opt=ValidateEmail&ID=" + this.txt_NickName.Text.Trim() + "&Email=" + this.txt_Email.Text.Trim(); string mailadd = m_user.Email; string mailSubject = "上上签密码找回"; #region SetEmailContent string mailBody = CommonTools.ReadHtmFile(AppConfig.AdvFolderPath + @"EmailTemplate/FindPassword.htm"); mailBody.Replace("@nickname", m_user.NickName); mailBody.Replace("@password", m_user.Password); //mailBody.Replace("@userid", m_user.SysNo.ToString()); //mailBody.Replace("@md5",CommonTools.md5(m_user.NickName+m_user.Password+DateTime.Now.ToString("yyyyMMddHHmmss"),32); #endregion SetEmailContent //邮件发送 TCPMail oMail = new TCPMail(); oMail.Html = true; if (oMail.Send(mailadd, mailSubject, mailBody)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "emailsend", "alert('邮件已发送,请注意查收!');", true); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "emailsend", "alert('发送邮件失败,请联系管理员!');", true); } } catch (Exception exp) { LogManagement.getInstance().WriteException(exp, "FindPass", Request.UserHostAddress); Page.ClientScript.RegisterStartupScript(this.GetType(), "emailsend", "alert('发送邮件失败,请联系管理员!');", true); } } }
protected void Unnamed1_Click(object sender, EventArgs e) { AdvTopicMod m_topic = new AdvTopicMod(); if (type == "EDIT") { if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { SysNo = int.Parse(Request.QueryString["id"]); } m_topic = AdvTopicBll.GetInstance().GetModel(SysNo); try { m_topic.Title = txtName.Text.Trim(); m_topic.Group = int.Parse(drpGroup.SelectedValue); m_topic.DR = int.Parse(drpStatus.SelectedValue); AdvTopicBll.GetInstance().Update(m_topic); LogManagement.getInstance().WriteTrace(m_topic.SysNo, "APP.AdvTopic.Update", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username); ltrNotice.Text = "该记录已保存成功!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true); } catch { ltrError.Text = "输入资料格式有误,请检查!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true); return; } } else if (type == "ADD") { try { m_topic.Title = txtName.Text.Trim(); m_topic.Group = int.Parse(drpGroup.SelectedValue); m_topic.DR = int.Parse(drpStatus.SelectedValue); m_topic.TS = DateTime.Now; AdvTopicBll.GetInstance().Add(m_topic); LogManagement.getInstance().WriteTrace(m_topic.SysNo, "APP.AdvTopic.Add", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username); ltrNotice.Text = "该记录已保存成功!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true); } catch { ltrError.Text = "输入资料格式有误,请检查!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true); return; } } }
public ActionResult SaveContractContext(InstagramContract entity) { LogManagement.Logging("update Instagramcontext", (int)LogType.Info, "Update InstagramContractContext", "InstagramContractController/SaveInstagramContractContext"); var errorMessage = ""; try { InstagramContractService.GetInstance().SaveContext(entity.ContractContext); } catch (Exception e) { errorMessage = e.Message; } return(Json(errorMessage, JsonRequestBehavior.AllowGet)); //message }
public void LoginCheck(string username, string password) { SYS_AdminMod m_admin = SYS_AdminBll.GetInstance().CheckAdmin(username, password); if (m_admin.CustomerSysNo != AppConst.IntNull)//COOKIES验证成功 { WebForAnalyse.SessionInfo m_session = new SessionInfo(); m_session.AdminEntity = m_admin; m_session.PrivilegeDt = SYS_AdminBll.GetInstance().GetAdminPrivilege(m_admin.CustomerSysNo); Session[AppConfig.AdminSession] = m_session; //记住我 if (CheckBox1.Checked) { HttpCookie Cookie = CookiesHelper.GetCookie("upup1000Admin"); if (Cookie == null || Cookie.Value == null || Cookie.Value == "") { Cookie = new HttpCookie("upup1000Admin"); Cookie.Values.Add("uname", CommonTools.Encode(username)); Cookie.Values.Add("psd", CommonTools.Encode(password)); //设置Cookie过期时间 Cookie.Expires = DateTime.Now.AddYears(50); CookiesHelper.AddCookie(Cookie); } else { CookiesHelper.SetCookie("upup1000Admin", "uname", CommonTools.Encode(username), DateTime.Now.AddYears(50)); CookiesHelper.SetCookie("upup1000Admin", "psd", CommonTools.Encode(password), DateTime.Now.AddYears(50)); } } LogManagement.getInstance().WriteTrace(m_session.AdminEntity, "Login", "IP:" + Request.UserHostAddress + "|AdminID:" + m_session.AdminEntity.Username); //跳转 if (Request.QueryString["url"] != null && Request.QueryString["url"] != "") { Response.Redirect(Request.QueryString["url"]); } else { Response.Redirect("BaZi/PatternList.aspx"); } } else { this.ltrNotice.Text = "用户名或密码错误!"; base.ClientScript.RegisterStartupScript(base.GetType(), "", "document.getElementById('" + divNotice.ClientID + "').style.display='';", true); } }
protected void Unnamed2_Click(object sender, EventArgs e) { string username = txtEmail.Text.Trim(); string password = txtPass.Text.Trim(); #region 验证邮箱有效性 #endregion USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckUser(username, password); if (m_user.SysNo != AppConst.IntNull)//COOKIES验证成功 { SessionInfo m_session = new SessionInfo(); m_session.CustomerEntity = m_user; m_session.GradeEntity = USR_GradeBll.GetInstance().GetModel(m_user.SysNo); Session[AppConfig.CustomerSession] = m_session; //记住我 if (chkRemember.Checked) { HttpCookie Cookie = CookiesHelper.GetCookie("upup1000"); if (Cookie == null || Cookie.Value == null || Cookie.Value == "") { Cookie = new HttpCookie("upup1000"); Cookie.Values.Add("uname", CommonTools.Encode(username)); Cookie.Values.Add("psd", CommonTools.Encode(password)); //设置Cookie过期时间 Cookie.Expires = DateTime.Now.AddYears(50); CookiesHelper.AddCookie(Cookie); } else { CookiesHelper.SetCookie("upup1000", "uname", CommonTools.Encode(username), DateTime.Now.AddYears(50)); CookiesHelper.SetCookie("upup1000", "psd", CommonTools.Encode(password), DateTime.Now.AddYears(50)); } } LogManagement.getInstance().WriteTrace("前台会员登录", "Login", "IP:" + Request.UserHostAddress + "|AdminID:" + m_session.CustomerEntity.Email); //跳转 Response.Redirect("Qin/View/" + m_user.SysNo); } else { Response.Redirect("Passport/Login.aspx?email=" + txtEmail.Text.Trim() + "&error=" + (int)AppEnum.ErrorType.WrongAccount); } }
public string GetTopicByPhone(string PhoneNum, string TimeStamp, string sign) { if (CommonTools.md5(PhoneNum + TimeStamp + AppConfig.AnXin360Key(), 32) == sign.ToLower()) { try { return(SearchTopic(PhoneNum)); } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "AnXin360App", "", "通过手机号获取推广主题"); return("Service Error"); } } else { return("Wrong Key"); } }
/// <summary> /// 执行SQL语句无返回(SQL语句必须过滤参数) /// </summary> /// <param name="CommandText"></param> public void CmdtoNone(string CommandText) { try { m_cmd.CommandText = CommandText; m_conn.Open(); m_cmd.ExecuteNonQuery(); ReturnValue = "1"; } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "SQLData,相关SQL语句:" + CommandText, HttpContext.Current.Request.RawUrl + " | " + HttpContext.Current.Request.UserHostAddress); ReturnValue = "0"; } finally { m_conn.Close(); } }
public void LoginCheck(string username, string password) { USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckUser(username, password); if (m_user.SysNo != AppConst.IntNull)//COOKIES验证成功 { SetSession(m_user); //记住我 if (CheckBox1.Checked) { HttpCookie Cookie = CookiesHelper.GetCookie("upup1000"); if (Cookie == null || Cookie.Value == null || Cookie.Value == "") { Cookie = new HttpCookie("upup1000"); Cookie.Values.Add("uname", CommonTools.Encode(username)); Cookie.Values.Add("psd", CommonTools.Encode(password)); //设置Cookie过期时间 Cookie.Expires = DateTime.Now.AddYears(50); CookiesHelper.AddCookie(Cookie); } else { CookiesHelper.SetCookie("upup1000", "uname", CommonTools.Encode(username), DateTime.Now.AddYears(50)); CookiesHelper.SetCookie("upup1000", "psd", CommonTools.Encode(password), DateTime.Now.AddYears(50)); } } LogManagement.getInstance().WriteTrace("前台会员登录", "Login", "IP:" + Request.UserHostAddress + "|UserID:" + GetSession().CustomerEntity.Email); //跳转 if (Request.QueryString["url"] != null && Request.QueryString["url"] != "") { Response.Redirect(Request.QueryString["url"]); } else { Response.Redirect("../Qin/View/" + m_user.SysNo); } } else { password1Tip.InnerHtml = AppEnum.GetErrorType(2); } }
protected void Unnamed2_Click(object sender, EventArgs e) { try { USR_SMSMod m_sms = new USR_SMSMod(); m_sms.Context = SQLData.SQLFilter(txtReply.Text.Trim()); m_sms.DR = (int)AppEnum.State.normal; m_sms.FromSysNo = GetSession().CustomerEntity.SysNo; m_sms.IsFromDeleted = (int)AppEnum.BOOL.False; m_sms.IsRead = (int)AppEnum.BOOL.False; m_sms.IsToDeleted = (int)AppEnum.BOOL.False; if (SysNo != 0) { m_sms.Parent = SysNo; } else { m_sms.Parent = 0; } m_sms.ReplyCount = 0; m_sms.Title = ""; m_sms.TS = DateTime.Now; m_sms.ToSysNo = TargetID; int tmp = USR_SMSBll.GetInstance().AddSMS(m_sms); if (SysNo != 0) { BindList(); ClientScript.RegisterStartupScript(this.GetType(), "reply", "alert('发送成功!');", true); } else { Response.Redirect("MsgDetail.aspx?id=" + tmp); } } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "reply", "alert('系统故障,请重新尝试');", true); LogManagement.getInstance().WriteException(ex, "SMS-reply", Request.UserHostAddress, "发送短信失败"); } }
protected void Unnamed1_Click(object sender, EventArgs e) { if (txtTitle.Text.Trim() == "") { ltrError.Text = "请输入标题!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true); return; } if (txtContext.Text.Trim() == "") { ltrError.Text = "请输入内容!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true); return; } try { USR_NoticeMod m_notice = new USR_NoticeMod(); m_notice.Condition = txtWhere.Text.Trim(); m_notice.Context = txtContext.Text.Trim(); m_notice.DR = (int)AppEnum.State.prepare; m_notice.Title = txtTitle.Text.Trim(); m_notice.TS = DateTime.Now; m_notice.CustomerNum = 0; USR_NoticeBll.GetInstance().Add(m_notice); LogManagement.getInstance().WriteTrace(m_notice.SysNo, "Notice.Send", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username); ltrNotice.Text = "该消息已添加到发送队列中!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true); PrepareForm(); } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "Notice.Send", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username); ltrError.Text = "系统错误,请检查!"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true); return; } }
/// <summary> /// 执行SQL语句返回DataRow(SQL语句必须过滤参数) /// </summary> /// <param name="CommandText"></param> /// <returns></returns> public DataRow CmdtoDataRow(string CommandText) { DataTable ret = new DataTable(); try { m_cmd.CommandText = CommandText; m_conn.Open(); SqlDataAdapter m_adpt = new SqlDataAdapter(m_cmd); m_adpt.Fill(ret); } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "SQLData,相关SQL语句:" + CommandText, HttpContext.Current.Request.RawUrl + " | " + HttpContext.Current.Request.UserHostAddress); } finally { m_conn.Close(); } return(ret.Rows[0]); }
/// <summary> /// 执行存储过程无返回 /// </summary> /// <param name="StoredProcedure"></param> public void SPtoNone(string StoredProcedure) { try { SqlParameter retpara = m_cmd.Parameters.Add("@reValue", SqlDbType.Int); retpara.Direction = ParameterDirection.ReturnValue; m_cmd.CommandText = StoredProcedure; m_cmd.CommandType = CommandType.StoredProcedure; m_conn.Open(); m_cmd.ExecuteNonQuery(); ReturnValue = m_cmd.Parameters["@reValue"].Value.ToString(); } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "SQLData,相关SP:" + StoredProcedure, HttpContext.Current.Request.RawUrl + " | " + HttpContext.Current.Request.UserHostAddress); } finally { m_conn.Close(); } }
public ActionResult Delete(int id) { var hasAccess = AuthorizationManager.HasAccess("InstagramContract.Delete"); if (!hasAccess) { throw new Exception("شما مجاز به انجام این عملیات نیستید"); } LogManagement.Logging($"Delete InstagramContract id:{id}", (int)LogType.Info, "Delete InstagramContract", "InstagramContractController/DeleteAction"); var errorMessage = ""; try { InstagramContractService.GetInstance().Delete(id); } catch (Exception e) { errorMessage = e.Message; } return(Json(errorMessage, JsonRequestBehavior.AllowGet)); //message }
/// <summary> /// The only instance of LogManagement /// </summary> /// <returns></returns> public static LogManagement Instance() { if (instance == null) { instance = new LogManagement(); } return instance; }