public List <VisitBill> P_HisVisit(string userName, int curPage, int pageSize) { string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string; string session = Session.SessionID.ToString(); if (!cookies.Equals(session)) { return(null); } MLogin.GetExeUname(); int num = curPage * pageSize; string sql = "select top " + pageSize.ToString() + " o.* from ( " + " select row_number() over(order by id desc) as rownumber,a.* from( " + " select id, client, billdate, notepre, code from clientservice_VisitBill where billman = '" + userName + "') as a ) as o where rownumber> " + num.ToString(); DataTable dt = DBLL.ExecuteDataTable(MyGlobal.DataBase, sql); List <VisitBill> history = new List <VisitBill>(); foreach (DataRow c in dt.Rows) { VisitBill b = new VisitBill(); b.code = c["CODE"].ToString(); b.client = c["CLIENT"].ToString(); b.date = Convert.ToDateTime(c["BILLDATE"].ToString()).ToString("yyyy-MM-dd"); b.content = c["NOTEPRE"].ToString(); history.Add(b); } return(history); }
public ActionResult ChangePassword(FormCollection coll) { ViewBag.Title = Conf.TITLE_PUBLIC + " - Đổi mật khẩu"; string txtPasswordOld = coll["txtPasswordOld"]; string txtPasswordNew = coll["txtPasswordNew1"]; try { MLogin u = (MLogin)Session["userPublic"]; nguoidung us = db.nguoidungs.Where(x => x.id_user == u.id).Where(x => x.password == txtPasswordOld).SingleOrDefault(); if (us != null) { us.password = txtPasswordNew; db.SubmitChanges(); ViewBag.error = Lib.messengerPublic("Đổi mật khẩu thành công"); } else { ViewBag.error = Lib.messengerPublic("Mật khẩu cũ không chính xác"); } } catch (Exception ex) { ViewBag.error = Lib.messengerPublic("Đổi mật khẩu thất bại"); } return(View()); }
public string Reply(int id, string reply, string userName, double lng, double lat, double kflng, double kflat) { string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string; string session = Session.SessionID.ToString(); if (!cookies.Equals(session)) { return(null);//身份验证失败 } MLogin.GetExeUname(); if (MyGlobal.AERA_CHECK)//是否检核范围 { if (kflng == -1 || kflat == -1) { return("None"); } if (ScueFun.LngLatDis.GetDistance(lng, lat, kflng, kflat) > MyGlobal.VISITAERA)//超出范围 { return("Toofar"); } } //事务处理开始,劫持链接通道的sql语句 TransactionSql.Start(MyGlobal.DataBase); //===>开始 DateTime now = SysTime.GetTime; List <RpBill> result = new List <RpBill>(); L_ContactSheetMsg msg = new L_ContactSheetMsg(); msg.MTITLE = reply; msg.INSERTER = userName; msg.FID = id; msg.INSERTDATE = now; msg.STATE = "已提交"; int get_id = msg.Insert(); List <L_ContactSheetMsg> msg_list = msg.Select(" and INSERTDATE='" + now.ToString() + "' "); L_ContactSheet l_Contact = new L_ContactSheet(); List <L_ContactSheet> list = l_Contact.Select(" and id = " + id.ToString()); if (list.Count > 0) { //更新关联单据号,最新的,可作为最后打卡的目标公司,名称、地址 20180904 skl puku_user u = new puku_user(); u.REFERCODE = msg_list.Count > 0 ? msg_list[0].ID.ToString():""; u.ZF1 = list[0].CLIENT; u.ZF2 = kflng.ToString(); u.ZF3 = kflat.ToString(); u.ZF4 = now.ToString("yyyy-MM-dd HH:mm:ss"); u.Updata(" and TURENAME='" + userName + "' "); } else { return("没有该联络单!"); } //提交事务到sql服务器处理//===>结束 if (!TransactionSql.EndSql())//判断是否成功 { return("回复失败!"); } return(msg.INSERTDATE.ToString()); }
public List <VisitBill> HisVisit(string userName) { string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string; string session = Session.SessionID.ToString(); if (!cookies.Equals(session)) { return(null); } MLogin.GetExeUname(); clientservice_VisitBill bills = new clientservice_VisitBill(); List <clientservice_VisitBill> list = bills.Select(" and billman='" + userName + "' order by id desc ", " top 20 client,billdate,notepre,code"); List <VisitBill> history = new List <VisitBill>(); foreach (clientservice_VisitBill c in list) { VisitBill b = new VisitBill(); b.code = c.CODE; b.client = c.CLIENT; b.date = c.BILLDATE.ToString("yyyy-MM-dd"); b.content = c.NOTEPRE; history.Add(b); } return(history); }
public List <LLBill> NeighborBill(string id, string userName, double lng, double lat, int curPage, int pageSize) { string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string; string session = Session.SessionID.ToString(); if (!cookies.Equals(session)) { return(null);//身份验证失败 } MLogin.GetExeUname(); DataTable dt = Function.NeighbourBill(curPage, pageSize, lng, lat); List <LLBill> result = new List <LLBill>(); foreach (DataRow row in dt.Rows) { LLBill n = new LLBill(); n.id = row["ID"].ToString(); //客户 n.client = row["CLIENT"].ToString(); //客户 n.code = row["CODE"].ToString(); //单号 n.depar = row["DEPAR"].ToString(); //部门 n.finshdate = Convert.ToDateTime(row["FINSHDATE"].ToString()).ToString("yyyy-MM-dd"); //要求完成时间 n.id = row["ID"].ToString(); n.inserter = row["INSERTER"].ToString(); //提出人 n.machinecn = row["MACHINECN"].ToString(); //机床编号 n.mtitle = row["MTITLE"].ToString(); //内容 n.type = row["TYPE"].ToString(); //状态 n.distance = row["DISTANCE"].ToString() + "km"; //距离 n.contactor = row["CONTACTOR"].ToString(); //联系人 n.phone = row["PHONE"].ToString(); //电话 n.lng = row["ZF29"].ToString(); //经度 n.lat = row["ZF30"].ToString(); //纬度 result.Add(n); } return(result); }
public List <RpBill> GetReply(string fid) { string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string; string session = Session.SessionID.ToString(); if (!cookies.Equals(session)) { return(null);//身份验证失败 } MLogin.GetExeUname(); List <RpBill> result = new List <RpBill>(); L_ContactSheetMsg msg = new L_ContactSheetMsg(); List <L_ContactSheetMsg> list = msg.Select(" and fid='" + fid + "' order by id desc ", " top 30 * "); foreach (L_ContactSheetMsg r in list) { RpBill n = new RpBill(); n.createtime = r.INSERTDATE.ToString("yyyy-MM-dd HH:mm:ss"); n.state = r.STATE; n.inserter = r.INSERTER; n.content = r.MTITLE; result.Add(n); } return(result); }
public ActionResult Login(FormCollection coll) { string txtUsername = coll["txtTK"].ToString(); string txtPassword = coll["txtMK"].ToString(); MLogin us = db.nguoidungs.Where(x => x.username == txtUsername).Where(x => x.password == txtPassword) .Select(x => new MLogin { id = x.id_user, name = x.hoten, role = x.role, accessCMS = x.role1.truycap_cms, special = x.role1.special }).FirstOrDefault(); if (us != null) { if (us.accessCMS == false) { ViewBag.error = Lib.messenger(1, "Truy cập bị giới hạn!"); return(View()); } else { Session["user"] = us; return(Redirect("/admin/")); } } else { ViewBag.error = Lib.messenger(2, "Sai tài khoản hoặc mật khẩu!"); return(View()); } }
private void button1_Click(object sender, EventArgs e) { var appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); MLogin login = new MLogin(); MSession session = MSession.GetOfflineSession(textBox1.Text); session = login.TryAutoLogin(); Minecraft.Initialize(Path.Combine(appDataPath, @"SkyLauncher\")); MProfileInfo[] infos = MProfileInfo.GetProfiles(); MProfile profile = MProfile.FindProfile(infos, "1.12.2"); DownloadGame(profile); var option = new MLaunchOption() { // must require StartProfile = profile, JavaPath = "java.exe", //SET YOUR JAVA PATH (if you want autoset, goto wiki) MaximumRamMb = 4096, // MB Session = MSession.GetOfflineSession(textBox1.Text), // not require LauncherName = "McLauncher", // display launcher name at main window CustomJavaParameter = "" // set your own java args }; MLaunch launch = new MLaunch(option); launch.GetProcess().Start(); }
private void button1_Click(object sender, EventArgs e) { var appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); MLogin login = new MLogin(); MSession session = MSession.GetOfflineSession(textBox1.Text); session = login.TryAutoLogin(); Minecraft.Initialize(Path.Combine(appDataPath, @"SkyLauncher\")); MProfileInfo[] infos = MProfileInfo.GetProfiles(); MProfile profile = MProfile.FindProfile(infos, comboBox1.SelectedItem.ToString()); DownloadGame(profile); var option = new MLaunchOption() { // must require StartProfile = profile, JavaPath = "java.exe", //JAVA PAT MaximumRamMb = 4096, // MB Session = MSession.GetOfflineSession(textBox1.Text), // not require LauncherName = "SkyLauncher", CustomJavaParameter = "" // java args }; MLaunch launch = new MLaunch(option); launch.GetProcess().Start(); }
private void MainForm_Shown(object sender, EventArgs e) { // Initialize launcher Txt_Path.Text = Minecraft.GetOSDefaultPath(); var th = new Thread(new ThreadStart(delegate { InitializeLauncher(); // Try auto login var login = new MLogin(); MSession result = login.TryAutoLogin(); if (result.Result != MLoginResult.Success) { return; } MessageBox.Show("Auto Login Success!"); Session = result; Invoke((MethodInvoker) delegate { Btn_Login.Enabled = false; Btn_Login.Text = "Auto Login\nSuccess"; }); })); th.Start(); }
public MSession Login(string loginEmail, string LoginPass, bool ifPremium) { var session = new MSession(); if (ifPremium) { var login = new MLogin(); session = login.TryAutoLogin(); session = login.Authenticate(loginEmail, LoginPass); if (session.Result != MLoginResult.Success) { LoggerUpdate("[Auth]" + "Unsuccessful Login"); return(null); } else { LoggerUpdate("[Auth] Successful Login"); } accessToken = session.AccessToken; } else { session = MSession.GetOfflineSession(offlineUsername); } return(session); }
public int Sign(string userName, string userId, string type, double lng, double lat) { string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string; string session = Session.SessionID.ToString(); if (!cookies.Equals(session)) { return(-10);//身份验证失败 } MLogin.GetExeUname(); if (type.ToUpper() == "SIGNIN") { return(SignCS.SignIn(userName, userId, lng, lat)); } else if (type.ToUpper() == "SIGNOUT") { return(SignCS.SignOut(userName, userId, lng, lat)); } else if (type != "") { if (MyGlobal.SignType)//区分签到签退 { return(SignCS.Sign_P(userName, userId, lng, lat, type)); } else { return(SignCS.Sign_P(userName, userId, lng, lat, "")); } } else { return(-10);//身份验证失败 } }
public List <VisitBill> GetBills(string userName) { string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string; string session = Session.SessionID.ToString(); if (!cookies.Equals(session)) { return(null);//身份验证失败 } MLogin.GetExeUname(); List <VisitBill> result = new List <VisitBill>(); string date = DateTime.Now.Date.ToString(); clientservice_VisitBill bills = new clientservice_VisitBill(); List <clientservice_VisitBill> list = bills.Select(" and billman='" + userName + "' and BILLDATE='" + date + "' ", " client,billdate,notepre,code,zf3,zf4,zf5 ");//公司、拜访时间、内容、单号、名字、职位、电话 foreach (clientservice_VisitBill b in list) { VisitBill v = new VisitBill(); v.client = b.CLIENT; v.code = b.CODE; v.content = b.NOTEPRE; v.date = b.BILLDATE.ToString("yyyy-MM-dd"); v.hisname = b.ZF3; v.hisposition = b.ZF4; v.hisphone = b.ZF5; result.Add(v); } return(result); }
public void AccountFee(string userName, string client, string code, string eating, string other, string person, string traffic, string commission, string remark, string hisname, string hisphone, string note) { string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string; string session = Session.SessionID.ToString(); if (!cookies.Equals(session)) { return;//身份验证失败 } MLogin.GetExeUname(); TreatFee t = new TreatFee(); t.BILLCODE = ScueFun.Code.BasicCode("TreatFee", "BILLCODE", "TF"); t.CLIENT = client; t.VBCODE = code;//拜访单单号 t.BILLMAN = userName; t.EATING = eating; t.OTHER = other; t.PERSON = person; t.NAME = hisname; t.PHONE = hisphone; t.NOTE = note; t.TRAFFIC = traffic; t.COMMISSION = commission; //佣金申请 t.BLANK_STR_1 = remark; //备注,说明 t.CREATETIME = SysTime.GetTime.ToString("yyyy-MM-dd HH:mm:ss"); t.STATE = 0; //已提交 t.Insert(); }
public VSBill YW_Detail_Bill(string code) { string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string; string session = Session.SessionID.ToString(); if (!cookies.Equals(session)) { return(null);//身份验证失败 } MLogin.GetExeUname(); L_VisitSend s = new L_VisitSend(); VSBill vs = new VSBill(); //未接收消息 List <L_VisitSend> list = s.Select(" and CODE='" + code + "' "); if (list.Count <= 0) { return(null);//没有未接收消息 } else { L_VisitSend l = list[0]; vs.id = l.ID; vs.client = l.VISITCLIENT; vs.hisname = l.VISITNAME; vs.hisphone = l.VISITTEL; vs.content = l.VISITCONTENT; vs.notice = l.DOTHING; vs.visittype = l.VISITTYPE; vs.date = l.VISITDATE.ToShortDateString(); vs.state = l.STATE; vs.code = l.CODE; } return(vs); }
public ActionResult login(MLogin _login) { ManagerInfo cust = ManagerInfoBLL.GetModel(new ManagerInfo { AdminAccount = _login.UserName }); string username = _login.UserName; string passwd = _login.Password; string md5pass = GL.Common.Utils.MD5(passwd); if (cust == null || string.IsNullOrEmpty(cust.AdminAccount)) { return(Json( new { result = Result.UserDoesNotExist } )); } else if (md5pass != cust.AdminPasswd.ToLower()) { return(Json( new { result = Result.PasswordIsIncorrect } )); } else { cust.AdminMasterRight = masterRight.在线; ManagerInfoBLL.UpdateState(cust); Rule.Create(cust); return(Json( new { result = Result.Redirect } )); } }
public ActionResult Profile(FormCollection coll) { ViewBag.Title = Conf.TITLE_PUBLIC + " - Thông tin cá nhân"; string txtHoTen = coll["txtHoTen"]; string txtSDT = coll["txtSDT"]; string txtEmail = coll["txtEmail"]; string txtDiaChi = coll["txtDiaChi"]; string txtUser = coll["txtUser"]; MLogin us = (MLogin)Session["userPublic"]; try { nguoidung usEdit = db.nguoidungs.Where(x => x.id_user == us.id).Single(); usEdit.hoten = txtHoTen; usEdit.sdt = txtSDT; usEdit.email = txtEmail; usEdit.diachi = txtDiaChi; db.SubmitChanges(); us.hoTen = txtHoTen; ViewBag.error = Lib.messengerPublic("Cập nhật thành công"); } catch (Exception ex) { ViewBag.error = Lib.messengerPublic(ex.Message); } var user = db.nguoidungs.Where(x => x.id_user == us.id).Single(); return(View(user)); }
public int PoiBillAudit(string userName, string type, string id) { //审核bill string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string; string session = Session.SessionID.ToString(); if (!cookies.Equals(session)) { return(-1);//身份验证失败 } MLogin.GetExeUname(); L_PushPoi n = new L_PushPoi(); List <L_PushPoi> list = n.Select(" and id =" + id); if (list.Count <= 0) { return(-1); } else { n.ZF2 = userName; //审核人 n.ZF3 = SysTime.GetTime.ToString(); //审核时间 if (type.ToUpper() == "YES") { n.OPERATE_TYPE = "同意"; KFLocation.Set(list[0].BILLMAN, list[0].CLIENT, list[0].AFTER_LNG + "," + list[0].AFTER_LAT); } else { n.OPERATE_TYPE = "否决"; } return(n.Updata(" and id=" + id)); } }
public IActionResult Login([FromBody] MLogin login) { var person = _bPerson.SearchForPerson(login); if (person == null) { return(BadRequest(ResponseContent.Create(null, HttpStatusCode.BadRequest, "E-mail e/ou senha incorreto(s)!"))); } var passwordRecoveryRequest = _uRecoveryPassword.GetUserCurrentActive(person.Id); if (passwordRecoveryRequest != null) { passwordRecoveryRequest.CancelationDate = DateTime.Now; passwordRecoveryRequest.Active = false; _bPasswordRecovery.Update(passwordRecoveryRequest); _bHistory.SaveHistory(person.Id, "Usuário cancelou uma solicitação de recuperação da senha através do login"); } HttpContext.Session.Authenticate(person); var res = person.Profile == (int)EProfile.Teacher ? "/teacher" : "/student"; _bHistory.SaveHistory(person.Id, "Usuário autenticou no sistema"); return(Ok(ResponseContent.Create(res, HttpStatusCode.OK, null))); }
public bool AuditBills(string userName, string billcode, string opinion, string type) { bool flag = false; string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string; string session = Session.SessionID.ToString(); if (!cookies.Equals(session)) { return(flag);//身份验证失败 } MLogin.GetExeUname(); TreatFee t = new TreatFee(); if (type == "YES") { if (opinion.Trim() == "") { t.BLANK_STR_2 = "同意!"; } t.STATE = 10;//审核成功 } else { t.STATE = -1; //审核失败 t.BLANK_STR_2 = opinion; //审核意见 } t.AUDITDATE = System.DateTime.Now.ToString(); //审核时间 t.BLANK_STR_3 = userName; //审核人名字 t.Updata(" and BILLCODE='" + billcode + "' "); flag = true; return(flag); }
public List <KfkfCode> KFKF(string userId, string searchName) { //读取客户 用于客户搜索框 List <KfkfCode> ls = new List <KfkfCode>(); string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string; string session = Session.SessionID.ToString(); if (!cookies.Equals(session)) { KfkfCode C = new KfkfCode(); C.NAME = "session:" + session; ls.Add(C); KfkfCode C2 = new KfkfCode(); C2.NAME = "cookies:" + cookies; ls.Add(C2); return(ls); } MLogin.GetExeUname(); string sql = " select top 30 NAME,CONTACTOR,PHONE from ClientService_kfku where id in (select max(id) from ClientService_kfku group by name) " + " group by NAME,CONTACTOR,PHONE " + " HAVING NAME like '%" + searchName + "%' or CONTACTOR like '%" + searchName + "%' or PHONE like '%" + searchName + "%' "; DataTable table = (DataTable)BLL.SqltoView(MyGlobal.DataBase, BLL.数据类型.Table, sql); foreach (DataRow r in table.Rows) { KfkfCode C = new KfkfCode(); C.NAME = r["NAME"].ToString(); ls.Add(C); } return(ls); }
private JwtSecurityToken GenerarToken(MLogin login) { string ValidIssuer = _configuration["ApiAuth:Issuer"]; string ValidAudience = _configuration["ApiAuth:Audience"]; SymmetricSecurityKey IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_configuration["ApiAuth:SecretKey"])); //La fecha de expiracion sera el mismo dia a las 12 de la noche DateTime dtFechaExpiraToken; DateTime now = DateTime.Now; dtFechaExpiraToken = new DateTime(now.Year, now.Month, now.Day, 23, 59, 59, 999); //Agregamos los claim nuestros var claims = new[] { new Claim(Constantes.JWT_CLAIM_USUARIO, login.Usuario) }; return(new JwtSecurityToken ( issuer: ValidIssuer, audience: ValidAudience, claims: claims, expires: dtFechaExpiraToken, notBefore: DateTime.UtcNow, signingCredentials: new SigningCredentials(IssuerSigningKey, SecurityAlgorithms.HmacSha256) )); }
private void Main_Shown(object sender, EventArgs e) { // Initialize launcher Txt_Path.Text = Minecraft.GetOSDefaultPath(); var th = new Thread(new ThreadStart(delegate { InitializeLauncher(); // Try auto login var login = new MLogin(); MSession result = login.TryAutoLogin(); if (result.Result != MLoginResult.Success) { return; } MessageBox.Show("¡Auto inicio de sesión completado!\n\nUsuario: " + result.Username); Session = result; Invoke((MethodInvoker) delegate { Btn_Login.Enabled = false; Btn_Login.Text = "Auto inicio\nCompletado"; Txt_User.Text = Session.Username; Txt_Pass.Text = "#########"; }); })); th.Start(); }
MSession PremiumLogin() { var login = new MLogin(); // TryAutoLogin() read login cache file and check validation. // if cached session is invalid, it refresh session automatically. // but refreshing session doesn't always succeed, so you have to handle this. Console.WriteLine("Try Auto login"); Console.WriteLine(login.SessionCacheFilePath); var response = login.TryAutoLogin(); if (!response.IsSuccess) // cached session is invalid and failed to refresh token { Console.WriteLine("Auto login failed : {0}", response.Result.ToString()); Console.WriteLine("Input mojang email : "); var email = Console.ReadLine(); Console.WriteLine("Input mojang password : "******"failed to login. {0} : {1}", response.Result, response.ErrorMessage); Console.ReadLine(); Environment.Exit(0); return(null); } } return(response.Session); }
public async Task <ActionResult> Login(MLogin model) { if (!ModelState.IsValid) { return(View(model)); } // 这不会计入到为执行帐户锁定而统计的登录失败次数中 // 若要在多次输入错误密码的情况下触发帐户锁定,请更改为 shouldLockout: true var result = await SignInManager.PasswordSignInAsync(model.UserName, model.Password, model.RememberMe, shouldLockout : false); switch (result) { case SignInStatus.Success: return(RedirectToLocal(model.ReturnUrl)); case SignInStatus.LockedOut: ModelState.AddModelError("", "账号被锁定。"); //return View("Lockout"); return(View(model)); case SignInStatus.RequiresVerification: //return RedirectToAction("SendCode", new { ReturnUrl = model.ReturnUrl, RememberMe = model.RememberMe }); ModelState.AddModelError("", "验证码错误。"); return(View(model)); case SignInStatus.Failure: default: ModelState.AddModelError("", "客服账号或密码错误。"); return(View(model)); } }
private void SignIn(object sender, RoutedEventArgs e) { Progress.Value = 0; Progress.Opacity = 100; var th = new Thread(new ThreadStart(delegate { var login = new MLogin(); string email = ""; string password = ""; this.Dispatcher.Invoke(() => { email = Email.Text; password = userPassword.Password; }); var result = login.Authenticate(email, password); if (result.Result == MLoginResult.Success) { Session = result; Dispatcher.BeginInvoke(new Action(delegate { LoginStatus.Foreground = Brushes.LightGreen; LoginStatus.Text = "Successful login! Transfering you to the main window..."; this.Hide(); MainWindowNew mw = new MainWindowNew(Session); mw.Show(); })); } else { Dispatcher.BeginInvoke(new Action(delegate { LoginStatus.Foreground = Brushes.Red; LoginStatus.Text = "Please check your email/password"; Progress.Opacity = 0; })); } })); if (ifOffline.IsChecked != false) { Regex r = new Regex("^[a-zA-Z0-9_]+$"); if (r.IsMatch(Email.Text)) { MainWindowNew.ifOfflineMode = (bool)ifOffline.IsChecked; MainWindowNew mw = new MainWindowNew(MSession.GetOfflineSession(Email.Text)); mw.Show(); this.Close(); } else { LoginStatus.Text = "Invalid characters in your username"; Progress.Opacity = 0; } } else { th.Start(); } }
private void LoginActive(object sender, RoutedEventArgs e) { var th = new Thread(new ThreadStart(delegate { var login = new MLogin(); var session = login.TryAutoLogin(); if (session.Result == MLoginResult.Success) { Application.Current.Dispatcher.Invoke((Action) delegate { { MainWindowNew mw = new MainWindowNew(session); mw.Show(); this.Close(); } }); } else { Dispatcher.BeginInvoke(new Action(delegate { LoginCover.Visibility = Visibility.Hidden; LoginCover.IsEnabled = false; })); } })); th.Start(); }
private void Btn_Login_Click(object sender, EventArgs e) { // 로그인 버튼 눌렀을때 // 로그인함 Btn_Login.Enabled = false; if (Txt_Pw.Text == "") { //MessageBox.Show("배포용. 복돌기능 막혀잇습니다."); session = MSession.GetOfflineSession(Txt_Email.Text); MessageBox.Show("Offline login Success : " + Txt_Email.Text); } else { var th = new Thread(new ThreadStart(delegate { var login = new MLogin(); var result = login.Authenticate(Txt_Email.Text, Txt_Pw.Text); if (result.Result == MLoginResult.Success) { MessageBox.Show("Login Success : " + result.Username); session = result; } else { MessageBox.Show(result.Result.ToString() + "\n" + result.Message); Invoke((MethodInvoker) delegate { Btn_Login.Enabled = true; }); } })); th.Start(); } }
public List <PushPoi> AuditPoi(string userName, int curPage, int pageSize) { //获得bill string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string; string session = Session.SessionID.ToString(); if (!cookies.Equals(session)) { return(null);//身份验证失败 } MLogin.GetExeUname(); int num = curPage * pageSize; string where = ""; string sql = ""; if (userName == "郑昌仁") { where = " and zf1='总经办' "; } else if (userName == "王娅丽") { where = " and zf1='销售内勤' "; } else if (userName == "邵凯丽") { } else { return(null); } sql = "select top " + pageSize.ToString() + " o.* from ( " + " select row_number() over(order by id desc) as rownumber,a.* from( " + " select * from L_PushPoi where 1=1 and OPERATE_TYPE='已提交' " + where + ") as a ) as o where rownumber> " + num.ToString(); DataTable dt = DBLL.ExecuteDataTable(MyGlobal.DataBase, sql); List <PushPoi> result = new List <PushPoi>(); foreach (DataRow row in dt.Rows) { PushPoi p = new PushPoi(); p.ID = row["ID"].ToString(); p.BILLMAN = row["BILLMAN"].ToString(); p.OPERATE_TIME = row["OPERATE_TIME"].ToString(); p.OPERATE_TYPE = row["OPERATE_TYPE"].ToString(); p.CLIENT = row["CLIENT"].ToString(); p.BEFORE_LNG = row["BEFORE_LNG"].ToString(); //原始定位 p.BEFORE_LAT = row["BEFORE_LAT"].ToString(); p.AFTER_LNG = row["AFTER_LNG"].ToString(); //经度//现在请求定位 p.AFTER_LAT = row["AFTER_LAT"].ToString(); //纬度 double dis = ScueFun.LngLatDis.GetDistance(Convert.ToDouble(row["BEFORE_LNG"].ToString()), Convert.ToDouble(row["BEFORE_LAT"].ToString()), Convert.ToDouble(row["AFTER_LNG"].ToString()), Convert.ToDouble(row["AFTER_LAT"].ToString())); p.DISTANCE = Math.Round(dis / 1000, 2).ToString() + "km"; result.Add(p); } return(result); }
public bool Upload() { try { string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string; string session = Session.SessionID.ToString(); if (!cookies.Equals(session)) { return(false);//身份验证失败 } MLogin.GetExeUname(); System.Web.HttpContext.Current.Response.ContentType = "image/jpeg"; //var file = System.Web.HttpContext.Current.Request.Files[0]; //if(file.FileName == "") //{ // return "filename为空!"; //} string result = null; string result2 = null; result = System.Web.HttpContext.Current.Request["value1"]; result2 = System.Web.HttpContext.Current.Request["value2"]; HttpPostedFile f = System.Web.HttpContext.Current.Request.Files[0]; Random rad = new Random(); //实例化随机数产生器rad; int value = rad.Next(1000, 10000); //用rad生成大于等于1000,小于等于9999的随机数; string file_name = System.DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + result + "_" + value.ToString() + ".jpg"; // f.SaveAs(Server.MapPath(file_name)); byte[] bytes = StreamToBytes(f.InputStream); //将需要存储的图片读取为数据流 // FileStream fileStream = new FileStream(Server.MapPath(file_name), FileMode.Open, FileAccess.Read); //BinaryReader binaryReader = new BinaryReader(fileStream); //byte[] res = binaryReader.ReadBytes(Convert.ToInt32(fileStream.Length)); //binaryReader.Close(); //fileStream.Close(); IBLL.售后附件(bytes, file_name, result2, result); return(true); // return string.IsNullOrEmpty(result) ? "" : result; } catch (Exception ex) { return(false); } //Stream s = System.Web.HttpContext.Current.Request.InputStream; //byte[] b = new byte[s.Length]; //s.Read(b, 0, (int)s.Length); //Encoding.UTF8.GetString(b); //string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string; //string session = Session.SessionID.ToString(); //if (!cookies.Equals(session)) //{ // return null;//身份验证失败 //} //MLogin.GetExeUname(); }
/// <summary> /// 登陆按钮 /// </summary> /// <param name="userID">用户名</param> /// <param name="pwd">用户密码</param> /// <param name="validateCode">验证码</param> /// <returns>结果</returns> public JsonResult LoginIndex(string userID, string pwd, string validateCode) { string errMsg = string.Empty; string result = string.Empty; try { if (string.IsNullOrEmpty(userID)) { result = "请输入用户名!"; return this.Json("请输入用户名!"); } if (string.IsNullOrEmpty(pwd)) { result = "请输入密码!"; return this.Json("请输入密码!"); } TrackIdManager.GetInstance(userID); if (string.IsNullOrEmpty(validateCode)) { ////TODO 提示输入验证码 result = "请输入验证码!"; return this.Json("请输入验证码!"); } string sessionValidateCode = this.Session["validatecode"] == null ? string.Empty : this.Session["validatecode"].ToString(); if (validateCode.Trim().ToLower() != sessionValidateCode.ToLower()) { ////TODO 提示验证码输入错误 result = "请输入验证码!"; return this.Json("验证码错误!"); } ClearCK1Cookie(); UserLoginServiceHelper.UserLoginServiceHelper userHelper = new UserLoginServiceHelper.UserLoginServiceHelper(); string message = string.Empty; MLogin login = new MLogin(); login.AccountId = userID; login.HostAddress = Request.UserHostAddress; MUserLoginInfo loginInfo = new MUserLoginInfo(); loginInfo.Staff_Id = userID; loginInfo.Password = pwd; if (userHelper.CommonLogin(loginInfo, ref message, ref login)) { MStaffInfo staffInfo = userHelper.GetStaffInfoModel(userID); ////登录用户不为平台时限制ip int staffType = staffInfo.StaffType; if (staffType != 1) { if (!userHelper.LimitIpLogin(staffInfo.Department_id, this.GetIpAddr())) { return this.Json("当前登录IP不在允许的登录IP范围内!", "text/html", JsonRequestBehavior.AllowGet); } } //// 平台登陆 if (staffInfo.StaffType != 1) { result = "当前账号无权限!"; return this.Json("当前账号无权限"); } //// 登录成功,创建本地票据 this.SetLocalTicket(staffInfo); //// TODO 保存用户对象 this.Session["$sessionName$_UserInfo"] = staffInfo; FormsAuthentication.SetAuthCookie(userID, false); result = "登陆成功"; return this.Json(result); } else { result = "用户名或密码错误!"; return this.Json(result); } } catch (AppException app) { errMsg = app.Message; result = errMsg; } catch (Exception ex) { AppException app = new AppException(string.Empty, ex.Message, ex, null); LogManager.Log.WriteException(app); errMsg = app.Message; result = errMsg; } finally { string addr = string.Empty; try { addr = IpLocator.GetIpLocation(System.Configuration.ConfigurationManager.AppSettings["IPFile"], this.GetIpAddr()).Country; } catch { } UiaccParam param = new UiaccParam(); param.SysId = "您的网站名称"; param.OperId = "登录"; param.UiId = "点击登录按钮"; param.UserIP = this.GetIpAddr(); param.UserName = userID; param.KeyMessage = "您的网站名称用户登录" + "用户ID:" + userID + "登录结果:" + result + "登录域名:" + HttpContext.Request.Url.Authority + " 登录城市:" + addr; if (TrackIdManager.CurrentTrackID == null) { TrackIdManager.GetInstance(param.UserName); } this.watch.Stop(); param.TimeSpan = this.watch.Elapsed; Better.Infrastructures.Log.LogManager.Log.WriteUiAcc(param); } if (!string.IsNullOrEmpty(errMsg)) { return this.Json("用户名或密码错误!"); } return this.Json(string.Empty); }