protected void Sign_Btn1(object sender, EventArgs e) { if (!string.IsNullOrEmpty(base.Request.QueryString["tid"]) && base.Request.QueryString["type"] == "1") { string text = base.Request.QueryString["tid"]; IList all = Work_Attend.Init().GetAll(string.Concat(new string[] { " AttendType=1 and UID=", this.Uid, " and AttendTimeID=", text, " and datediff(d,addtime,getdate())=0 " }), null); if (all.Count == 0) { Work_AttendSetInfo byId = Work_AttendSet.Init().GetById(Convert.ToInt32(text)); Work_AttendInfo work_AttendInfo = new Work_AttendInfo(); work_AttendInfo.AddTime = DateTime.Now; work_AttendInfo.UID = Convert.ToInt32(this.Uid); work_AttendInfo.DepID = Convert.ToInt32(this.DepID); work_AttendInfo.RealName = this.RealName; work_AttendInfo.DepName = this.DepName; work_AttendInfo.AttendTimeID = Convert.ToInt32(text); work_AttendInfo.StandardTimes = byId.AttendTimes; work_AttendInfo.StandardNames = byId.AttendNames; work_AttendInfo.SignTimes = DateTime.Now.TimeOfDay.ToString().Substring(0, 5); work_AttendInfo.SignDates = DateTime.Now.ToString("yyyy-MM-dd"); DateTime t = Convert.ToDateTime(byId.AttendTimes); DateTime t2 = Convert.ToDateTime(DateTime.Now.Hour + ":" + DateTime.Now.Minute); if (byId.AttendNames.Contains("上班")) { if (DateTime.Compare(t, t2) >= 0) { work_AttendInfo.SignJudge = "正常"; } else { work_AttendInfo.SignJudge = "迟到"; } } if (byId.AttendNames.Contains("下班")) { if (DateTime.Compare(t, t2) <= 0) { work_AttendInfo.SignJudge = "正常"; } else { work_AttendInfo.SignJudge = "早退"; } } work_AttendInfo.AttendType = 1; work_AttendInfo.Notes = "(" + RequestUtils.GetIP() + ") " + this.Notes1.Value; work_AttendInfo.BeginTime = DateTime.Now; work_AttendInfo.EndTime = DateTime.Now; Work_Attend.Init().Add(work_AttendInfo); base.Response.Write("<script>alert('上下班登记已添加!');window.location='WorkAttendAdd.aspx?type=1'</script>"); } } }
protected void Sign_Btn4(object sender, EventArgs e) { Work_AttendInfo work_AttendInfo = new Work_AttendInfo(); work_AttendInfo.AddTime = DateTime.Now; work_AttendInfo.UID = Convert.ToInt32(this.Uid); work_AttendInfo.DepID = Convert.ToInt32(this.DepID); work_AttendInfo.RealName = this.RealName; work_AttendInfo.DepName = this.DepName; work_AttendInfo.AttendTimeID = 0; work_AttendInfo.StandardTimes = ""; work_AttendInfo.StandardNames = ""; work_AttendInfo.SignTimes = ""; work_AttendInfo.SignDates = ""; work_AttendInfo.SignJudge = ""; work_AttendInfo.AttendType = 4; work_AttendInfo.TravelAddress = this.TravelAddress4.Value; work_AttendInfo.Notes = "(" + RequestUtils.GetIP() + ") " + this.Notes4.Value; work_AttendInfo.BeginTime = Convert.ToDateTime(base.Request.Form["BeginTime4"]); work_AttendInfo.EndTime = Convert.ToDateTime(base.Request.Form["EndTime4"]); work_AttendInfo.B1 = base.Request.Form["B1_4"]; work_AttendInfo.B2 = base.Request.Form["B2_4"]; work_AttendInfo.E1 = base.Request.Form["E1_4"]; work_AttendInfo.E2 = base.Request.Form["E2_4"]; Work_Attend.Init().Add(work_AttendInfo); base.Response.Write("<script>alert('出差登记已添加!');window.location='WorkAttendAdd.aspx?type=4'</script>"); }
private void Sendcom(Bas_ComInfo bi) { try { string comName = bi.ComName; string webUrl = bi.WebUrl; string text = bi.et4; string text2 = Utils.GetRequestHostUrl().ToLower().Replace("/manage/Sys/", ""); string iP = RequestUtils.GetIP(); string text3 = ""; string text4 = "sql610"; if (Utils.IsNumber(string.Concat(HttpContext.Current.Application[this.GetUtt()]))) { text3 = string.Concat(HttpContext.Current.Application[this.GetUtt()]); } string text5 = string.Concat(new string[] { "http://demo.job18.net/manage/sms/ttt.ashx?cname=", comName, "&curl=", webUrl, "&cet4=", text, "&tnt=", text3, "&hosts=", text2, "&ip=", iP, "&ver=", text4 }); string requestUriString = text5.Trim().ToString(); HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(requestUriString); httpWebRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"; httpWebRequest.Method = "GET"; httpWebRequest.Timeout = 11000; //WebResponse response = httpWebRequest.GetResponse(); HttpWebResponse response; try { response = (HttpWebResponse)httpWebRequest.GetResponse(); } catch (WebException ex) { response = (HttpWebResponse)ex.Response; } Stream responseStream = response.GetResponseStream(); StreamReader streamReader = new StreamReader(responseStream, Encoding.UTF8); streamReader.ReadToEnd(); } catch { } }
private static void BBS_Update(string u, string p, Sys_UserInfo dxbbs_ui) { if (dxbbs_ui != null) { string text = p.Substring(8, 16).ToLower(); string cmdText = "select * from WC_Forum_User where username=@u"; DataSet dataSet = MsSqlOperate.ExecuteDataset(CommandType.Text, cmdText, new SqlParameter[] { new SqlParameter("@u", u) }); string text2 = text; int num = Math.Abs(dxbbs_ui.Sex - 1); string text3; if (num != 1) { text3 = "userface/girl.jpg"; } else { text3 = "userface/boy.jpg"; } string realName = dxbbs_ui.RealName; string iP = RequestUtils.GetIP(); if (dataSet.Tables[0].Rows.Count > 0) { string cmdText2; if (dxbbs_ui.RoleID != 4) { cmdText2 = string.Concat(new object[] { "update WC_Forum_User set UserPass='******',sex=", num, ",NickName='", realName, "',LoginIP='", iP, "',LoginTime=getdate() where username='******';" }); } else { cmdText2 = string.Concat(new object[] { "update WC_Forum_User set UserPass='******',sex=", num, ",NickName='", realName, "',LoginIP='", iP, "',LevelID=1,LoginTime=getdate() where username='******';" }); } MsSqlOperate.ExecuteNonQuery(CommandType.Text, cmdText2, new SqlParameter[0]); } else { string cmdText3; if (dxbbs_ui.RoleID != 4) { cmdText3 = string.Concat(new object[] { "insert into WC_Forum_User(UserName,UserPass,PasswordType,Question,Answer,Email,Sex,Photo,PhotoWidth,PhotoHeight,NickName,LevelID,RegTime,UploadTime,LoginTime,LevelType,ip) values('", u, "','", text2, "',1,'123','456','*****@*****.**',", num, ",'", text3, "',100,100,'", realName, "',7,getdate(),getdate(),getdate(),5,'", iP, "');" }); } else { cmdText3 = string.Concat(new object[] { "insert into WC_Forum_User(UserName,UserPass,PasswordType,Question,Answer,Email,Sex,Photo,PhotoWidth,PhotoHeight,NickName,LevelID,RegTime,UploadTime,LoginTime,LevelType,ip) values('", u, "','", text2, "',1,'123','456','*****@*****.**',", num, ",'", text3, "',100,100,'", realName, "',1,getdate(),getdate(),getdate(),1,'", iP, "');" }); } MsSqlOperate.ExecuteNonQuery(CommandType.Text, cmdText3, new SqlParameter[0]); } dataSet.Dispose(); } }
protected void Save_Btn(object sender, EventArgs e) { if (!string.IsNullOrEmpty(base.Request.QueryString["uid"])) { Sys_UserInfo sys_UserInfo = this.ViewState["su"] as Sys_UserInfo; if (this.PassWord.Value.Trim() != "") { sys_UserInfo.PassWord = Encrypt.MD5_32(this.PassWord.Value.Trim().ToLower()); } sys_UserInfo.RealName = this.URealName.Value; sys_UserInfo.Sex = Convert.ToInt32(this.Sex1.SelectedValue); sys_UserInfo.Birthday = this.Birthday.Value; sys_UserInfo.Phone = this.Phone.Value; sys_UserInfo.RoleID = Convert.ToInt32(this.RoleID.SelectedValue); sys_UserInfo.DepID = Convert.ToInt32(this.parentID.SelectedValue); sys_UserInfo.DepName = this.ClearLeaf(this.parentID.Items[this.parentID.SelectedIndex].Text); sys_UserInfo.Status = Convert.ToInt32(this.Status1.SelectedValue); sys_UserInfo.IsLock = Convert.ToInt32(this.IsLock.Checked); sys_UserInfo.Notes = this.Notes.Value; sys_UserInfo.Tel = this.Tel.Value; sys_UserInfo.QQ = this.QQ.Value; sys_UserInfo.Email = this.Email.Value; sys_UserInfo.HomeAddress = this.HomeAddress.Value; sys_UserInfo.PositionName = this.PositionName.Value; sys_UserInfo.JoinTime = this.JoinTime.Value; sys_UserInfo.MsgTime = Convert.ToInt32(this.RoleGUID.SelectedValue); sys_UserInfo.MemoShare = Convert.ToInt32(this.MemoShare.Checked); sys_UserInfo.Orders = Convert.ToInt32(this.Orders.Value); sys_UserInfo.DepGUID = this.DepGuid.SelectedValue; if (this.Fup.HasFile) { FileExtension[] fileEx = new FileExtension[] { FileExtension.GIF, FileExtension.JPG, FileExtension.PNG, FileExtension.BMP }; if (FileSystemManager.IsAllowedExtension(this.Fup, fileEx)) { string userName = sys_UserInfo.UserName; string text = base.Server.MapPath("~/Files/common/"); string text2 = userName + Path.GetExtension(this.Fup.FileName); text += text2; this.Fup.PostedFile.SaveAs(text); sys_UserInfo.PerPic = text2; this.Fup.Dispose(); } } sys_UserInfo.et4 = this.UpdateFiles(); sys_UserInfo.et6 = this.userlist.Value; sys_UserInfo.et5 = this.namelist.Value; Sys_User.Init().Update(sys_UserInfo); Help.UpdateIMUser(sys_UserInfo); string str = HttpContext.Current.Server.HtmlEncode("您好!员工已编辑成功!"); base.Response.Redirect("~/InfoTip/Operate_Success.aspx?returnpage=" + base.Request.Url.AbsoluteUri + "&tip=" + str); } else { if (this.IsNewUsername(this.UUserName.Value.Trim().ToLower())) { Sys_UserInfo sys_UserInfo = new Sys_UserInfo(); sys_UserInfo.UserName = this.UUserName.Value.ToLower(); sys_UserInfo.PassWord = Encrypt.MD5_32(this.PassWord.Value.Trim().ToLower()); sys_UserInfo.RealName = this.URealName.Value; sys_UserInfo.Sex = Convert.ToInt32(this.Sex1.SelectedValue); sys_UserInfo.Birthday = this.Birthday.Value; sys_UserInfo.Phone = this.Phone.Value; sys_UserInfo.RoleID = Convert.ToInt32(this.RoleID.SelectedValue); sys_UserInfo.DepID = Convert.ToInt32(this.parentID.SelectedValue); sys_UserInfo.DepName = this.ClearLeaf(this.parentID.Items[this.parentID.SelectedIndex].Text); sys_UserInfo.Status = Convert.ToInt32(this.Status1.SelectedValue); sys_UserInfo.IsLock = Convert.ToInt32(this.IsLock.Checked); sys_UserInfo.RegFromIp = RequestUtils.GetIP(); sys_UserInfo.Notes = this.Notes.Value; sys_UserInfo.LastLoginTime = DateTime.Now; sys_UserInfo.RegTime = DateTime.Now; sys_UserInfo.Tel = this.Tel.Value; sys_UserInfo.QQ = this.QQ.Value; sys_UserInfo.Email = this.Email.Value; sys_UserInfo.MsgTime = 10; sys_UserInfo.HomeAddress = this.HomeAddress.Value; sys_UserInfo.PositionName = this.PositionName.Value; sys_UserInfo.JoinTime = this.JoinTime.Value; sys_UserInfo.MsgTime = Convert.ToInt32(this.RoleGUID.SelectedValue); sys_UserInfo.MemoShare = Convert.ToInt32(this.MemoShare.Checked); sys_UserInfo.Orders = Convert.ToInt32(this.Orders.Value); sys_UserInfo.DepGUID = this.DepGuid.SelectedValue; if (this.Fup.HasFile) { FileExtension[] fileEx = new FileExtension[] { FileExtension.GIF, FileExtension.JPG, FileExtension.PNG, FileExtension.BMP }; if (FileSystemManager.IsAllowedExtension(this.Fup, fileEx)) { string userName = sys_UserInfo.UserName; string text = base.Server.MapPath("~/Files/common/"); string text2 = userName + Path.GetExtension(this.Fup.FileName); text += text2; this.Fup.PostedFile.SaveAs(text); sys_UserInfo.ComGUID = text2; this.Fup.Dispose(); } } sys_UserInfo.et4 = this.UpdateFiles(); sys_UserInfo.et6 = this.userlist.Value; sys_UserInfo.et5 = this.namelist.Value; Sys_User.Init().Add(sys_UserInfo); Help.UpdateIMUser(sys_UserInfo); string title = "[系统通知] : " + sys_UserInfo.RealName + ", 您好! 您的系统账号已开通, 欢迎使用本系统!"; string content = "恭喜您! 您的系统账号已开通! <br><br>您的用户名:" + sys_UserInfo.UserName + " <br>您可以更改初始密码!如果您有其他疑问 请和系统管理员联系。<br>"; int id = sys_UserInfo.id; string text3 = string.Concat(new object[] { sys_UserInfo.RealName, "#", sys_UserInfo.id, "#", sys_UserInfo.DepName, "," }); string text4 = sys_UserInfo.RealName + "(" + sys_UserInfo.DepName + "),"; //Help.AdminSendMail(title, content, id, text3, text4); string str = HttpContext.Current.Server.HtmlEncode("您好!员工已添加成功!"); base.Response.Redirect("~/InfoTip/Operate_Success.aspx?returnpage=" + base.Request.Url.AbsoluteUri + "&tip=" + str); } else { base.Response.Write("<script>alert('该用户名已被占用!请另外选择');window.location='User_Manage.aspx'</script>"); } } }
private string CheckPass(string u, string p) { Hashtable hashtable = (Hashtable)HttpContext.Current.Application["stand_config"]; double value = Convert.ToDouble(hashtable["user_cookie_delay"]); IList list = new List <Sys_UserInfo>(); string cmdText = "select * from sys_user where UserName=@U and PassWord=@P"; using (DataSet dataSet = MsSqlOperate.ExecuteDataset(CommandType.Text, cmdText, new List <SqlParameter> { new SqlParameter("@U", u ?? ""), new SqlParameter("@P", Encrypt.MD5_32(p.Trim().ToLower()) ?? "") }.ToArray())) { if (dataSet.Tables[0].Rows.Count > 0) { list = (IList)Utils.GetList <Sys_UserInfo>(dataSet); } } string result; if (list.Count == 0) { result = "n"; } else { Sys_UserInfo sys_UserInfo = list[0] as Sys_UserInfo; sys_UserInfo.IsOnline = 1; sys_UserInfo.CurrentLoginTime = DateTime.Now.ToString("yyMddhhmmssfff"); string moduleList = this.GetModuleList(sys_UserInfo.DepID, sys_UserInfo.RoleID); string text = string.Concat(new object[] { sys_UserInfo.id, "|", sys_UserInfo.UserName, "|", sys_UserInfo.RealName, "|", sys_UserInfo.DepID, "|", sys_UserInfo.DepName, "|", moduleList, "|", sys_UserInfo.CurrentLoginTime, "|", base.Request.Form["px"] }); //string value2 = Encrypt.RC4_Encode(text, "lazy1111"); string value2 = Encrypt.EncryptString(text, "lazy1111"); HttpContext.Current.Session["UserCookies"] = text; HttpContext.Current.Session.Timeout = Convert.ToInt32(value) * 10; HttpCookie httpCookie = new HttpCookie("UserCookies"); if (!string.IsNullOrEmpty(base.Request.Form["chkRemember"])) { httpCookie.Expires = DateTime.Now.AddHours(value); } httpCookie["key"] = value2; base.Response.Cookies.Add(httpCookie); sys_UserInfo.LastLoginTime = DateTime.Now; sys_UserInfo.LastLoginIp = RequestUtils.GetIP(); sys_UserInfo.LoginQuantity++; Sys_User.Init().Update(sys_UserInfo); IList <Sys_UserInfo> list2 = base.Application["user_online"] as IList <Sys_UserInfo>; bool flag = false; foreach (object current in list2) { Sys_UserInfo sys_UserInfo2 = current as Sys_UserInfo; if (sys_UserInfo2.id == sys_UserInfo.id) { flag = true; sys_UserInfo2.IsOnline = 1; sys_UserInfo2.CurrentLoginTime = sys_UserInfo.CurrentLoginTime; sys_UserInfo2.LastLoginTime = sys_UserInfo.LastLoginTime; } } if (!flag) { list2.Add(sys_UserInfo); } Sys_UserLoginInfo sys_UserLoginInfo = new Sys_UserLoginInfo(); sys_UserLoginInfo.UserName = sys_UserInfo.UserName; sys_UserLoginInfo.UserInfo = sys_UserInfo.RealName + "(" + sys_UserInfo.DepName + ")"; sys_UserLoginInfo.LoginIP = RequestUtils.GetIP(); sys_UserLoginInfo.LoginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); Sys_UserLogin.Init().Add(sys_UserLoginInfo); result = sys_UserInfo.Status + "," + sys_UserInfo.IsLock; } return(result); }
private string CheckPass1(string u, string p) { Hashtable hashtable = (Hashtable)HttpContext.Current.Application["stand_config"]; double value = Convert.ToDouble(hashtable["user_cookie_delay"]); IList all = Sys_User.Init().GetAll(string.Concat(new string[] { " UserName='******' and PassWord='******' " }), null); string result; if (all.Count == 0) { result = "n"; } else { Sys_UserInfo sys_UserInfo = all[0] as Sys_UserInfo; this.dxbbs_ui = sys_UserInfo; sys_UserInfo.IsOnline = 1; sys_UserInfo.CurrentLoginTime = DateTime.Now.ToString("yyMddhhmmssfff"); string moduleList = this.GetModuleList(sys_UserInfo.DepID, sys_UserInfo.RoleID); HttpCookie httpCookie = new HttpCookie("UserCookies"); string encryptString = string.Concat(new object[] { sys_UserInfo.id, "|", sys_UserInfo.UserName, "|", sys_UserInfo.RealName, "|", sys_UserInfo.DepID, "|", sys_UserInfo.DepName, "|", moduleList, "|", sys_UserInfo.CurrentLoginTime, "|", base.Request.Form["px"] }); httpCookie.Expires = DateTime.Now.AddHours(value); string asasasas = Config.GetBeckHam(); httpCookie["key"] = Encrypt.RC4_Encode(encryptString, Config.GetBeckHam()); string asdasdsa = Encrypt.RC4_Encode(encryptString, Config.GetBeckHam()); base.Response.Cookies.Add(httpCookie); sys_UserInfo.LastLoginTime = DateTime.Now; sys_UserInfo.LastLoginIp = RequestUtils.GetIP(); sys_UserInfo.LoginQuantity++; Sys_User.Init().Update(sys_UserInfo); IList <Sys_UserInfo> list2 = base.Application["user_online"] as IList <Sys_UserInfo>; bool flag = false; foreach (object current in list2) { Sys_UserInfo sys_UserInfo2 = current as Sys_UserInfo; if (sys_UserInfo2.id == sys_UserInfo.id) { flag = true; sys_UserInfo2.IsOnline = 1; sys_UserInfo2.CurrentLoginTime = sys_UserInfo.CurrentLoginTime; sys_UserInfo2.LastLoginTime = sys_UserInfo.LastLoginTime; } } if (!flag) { list2.Add(sys_UserInfo); } //Hashtable hashtable2 = base.Application["user_online"] as Hashtable; //bool flag = false; //foreach (DictionaryEntry dictionaryEntry in hashtable2) //{ // if (dictionaryEntry.Key.ToString() == sys_UserInfo.id.ToString()) // { // flag = true; // } //} //if (flag) //{ // hashtable2[sys_UserInfo.id.ToString()] = sys_UserInfo; //} //else //{ // hashtable2.Add(sys_UserInfo.id.ToString(), sys_UserInfo); //} Sys_UserLoginInfo sys_UserLoginInfo = new Sys_UserLoginInfo(); sys_UserLoginInfo.UserName = sys_UserInfo.UserName; sys_UserLoginInfo.UserInfo = sys_UserInfo.RealName + "(" + sys_UserInfo.DepName + ")"; sys_UserLoginInfo.LoginIP = RequestUtils.GetIP(); sys_UserLoginInfo.LoginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); Sys_UserLogin.Init().Add(sys_UserLoginInfo); result = sys_UserInfo.Status + "," + sys_UserInfo.IsLock; } return(result); }