示例#1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //var _user = Session["User"] as EmployeeWithTypeBranch;

            mCIRCLE circle = new mCIRCLE();
            circle.CIRCLE_ENAME = txtCircleName.Text.Trim();
            circle.WING_ID = Convert.ToByte(ddlZone.SelectedValue);
            circle.Mobileno = txtMobile.Text.Trim();

            circle.officername = txtOfficerName.Text.Trim();
            circle.Std = txtSTD.Text.Trim();
            circle.Phoneno = txtPhoneNo.Text.Trim();
            circle.faxno = txtFaxNo.Text.Trim();

            try
            {
                if (Request["Code"] != null)
                {
                    circle.CIRCLE_ID = Convert.ToInt32(Server.HtmlEncode(Request["Code"]).ToString());

                    //zone.UpdatedBy = _user.employee.Id;
                    circle.Lastupdatedon = DateTime.Now;

                    cMethods.Update(circle);
                    js.ShowAlert(this, "Circle Updated successfully.");
                }
                else
                {
                    //zone.CreatedBy = _user.employee.Id;
                    circle.UpdateOn = DateTime.Now;

                    LoginMaster u = new LoginMaster();
                    u.UserId = txtLoginId.Text.Trim();
                    u.Password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text.Trim(), "MD5");
                    u.Name = txtOfficerName.Text.Trim();
                    u.Type = "C";

                    using (TransactionScope scope = new TransactionScope())
                    {
                        cMethods.Add(circle);
                        users.Create(u);
                        scope.Complete();
                    }
                    js.ShowAlert(this, "Circle Created successfully.");

                    Response.Redirect("CircleMaster.aspx", false);
                }
            }
            catch (Exception ex)
            {
                if (ex.InnerException.InnerException.Message.Contains("UNIQUE"))
                {
                    js.ShowAlert(this, "Login already exists! Please try another one.");
                }
                else
                {
                    js.ShowAlert(this, ex.Message);
                }
            }
        }
示例#2
0
        public int login([FromBody] LoginMaster l)
        {
            string value1;

            try
            {
                var usr = (from b in dc.GetTable <AuthorMaster>()
                           where b.mail == l.mail
                           select b).SingleOrDefault();

                var nce = (from a in dc.GetTable <RanNum>()
                           where a.mail == l.mail
                           select a).SingleOrDefault();
                using (MD5 md5Hash = MD5.Create())
                {
                    value1 = GetMd5Hash(md5Hash, usr.pass + nce.nonce.ToString());
                }
                if (value1 == l.pass)
                {
                    return(usr.Id);
                }
                else
                {
                    return(-1);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public ActionResult LoginView(LoginMaster loginMaster)
        {
            try
            {
                if (loginMaster != null && !string.IsNullOrEmpty(loginMaster.UserName) && !string.IsNullOrEmpty(loginMaster.Password))
                {
                    if (!_repoUnitOfWork.LoginRepository.ValidateUserName(loginMaster.UserName))
                    {
                        string _devOpsApplication = System.Configuration.ConfigurationManager.AppSettings["Key"];
                        string _devOpsHasTable    = System.Configuration.ConfigurationManager.AppSettings["HasTable"];
                        if (!string.IsNullOrEmpty(_devOpsApplication) && !string.IsNullOrEmpty(_devOpsHasTable))
                        {
                            string encryptedPasword = loginMaster.Password.GetEncryptedPassword(_devOpsApplication, _devOpsHasTable);
                            if (!string.IsNullOrEmpty(encryptedPasword))
                            {
                                var loginMasterData = _repoUnitOfWork.LoginRepository.LoginUser(loginMaster.UserName, encryptedPasword);
                                loginMaster.Message = "User Not Found. Signup";

                                if (loginMasterData != null && loginMasterData.LoginUserId != null)
                                {
                                }
                                else
                                {
                                    //loginMaster.Message = "User Not Found. Signup";
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(View(loginMaster));
        }
示例#4
0
        public ActionResult Login(LoginMaster lc, string clientpass)
        {
            if (ModelState.IsValid)
            {
                var client = Convert.ToInt32(lc.ClientId);

                var valid = db.checklogin(client, clientpass).ToList();

                if (valid[0] == 1)
                {
                    var defaultcheck = db.checkdefault(client).ToList();
                    Session["clientid"] = lc.ClientId;
                    if (defaultcheck[0] == 1)
                    {
                        return(RedirectToAction("ChangePassword", "Home"));
                    }
                    var role = db.get_role1(Convert.ToInt32(Session["clientid"])).ToList().FirstOrDefault().rolename;
                    if (role == "Admin")
                    {
                        var pendingcount = db.get_live_auction(Convert.ToInt32(Session["clientid"]), "NotApproved").ToList().Count;
                        if (pendingcount > 0)
                        {
                            return(RedirectToAction("PendingApproval", "Tender"));
                        }
                    }
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    ModelState.AddModelError("", "Invalid Client ID or Password");
                }
                return(RedirectToAction("Login", "Account"));
            }
            return(View());
        }
        public static Tuple <bool, int> ValidatingUserForAll(LoginMaster loginUser, object cases)

        {
            try
            {
                var parameterList = new List <Tuple <string, object> >
                {
                    Tuple.Create("@UserName", loginUser.UserName),
                    Tuple.Create("@Password", EncodePasswordToBase64(Convert.ToString(loginUser.Password))),
                    Tuple.Create("@CASES", cases)
                };
                DataSet executedSP = SqlConnectionSPHelper("ValidateUser", parameterList);
                bool    isExist = false; int id = default(int);
                for (int i = 0; i < executedSP.Tables[0].Rows.Count; i++)
                {
                    isExist = Convert.ToBoolean(executedSP.Tables[0].Rows[i]["IsExist"]);
                    id      = Convert.ToInt32(executedSP.Tables[0].Rows[i]["Id"]);
                }
                return(new Tuple <bool, int>(isExist, id));
            }
            catch (Exception ex)
            {
                return(new Tuple <bool, int>(false, default(int)));
            }
        }
示例#6
0
    public void SaveUserLoginDetails(string strIP, string strUserAgent, string srtHost, int iIsSuccessful)
    {
        LoginMaster objLoginMaster = new LoginMaster();

        objLoginMaster.LoginId           = Convert.ToString(txtUsername.Text);
        objLoginMaster.IP                = Convert.ToString(strIP);
        objLoginMaster.UserAgent         = Convert.ToString(strUserAgent);
        objLoginMaster.Host              = Convert.ToString(strHostName);
        objLoginMaster.LoginDate         = Convert.ToDateTime(DateTime.Now.Date).ToString("yyyy-MM-dd");
        objLoginMaster.LastRefreshedDate = Convert.ToDateTime(DateTime.Now.Date).ToString("yyyy-MM-dd");
        objLoginMaster.IsSucessfull      = iIsSuccessful;
        objLoginMasterManager.SaveLoginDetails(objLoginMaster);
    }
示例#7
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //var _user = Session["User"] as EmployeeWithTypeBranch;

            mWING zone = new mWING();
            zone.DESCRIPTION = txtZoneName.Text.Trim();

            try
            {
                if (Request["Code"] != null)
                {
                    zone.WING_ID = Convert.ToByte(Server.HtmlEncode(Request["Code"]).ToString());

                    //zone.UpdatedBy = _user.employee.Id;

                    zMethods.Update(zone);
                    js.ShowAlert(this, "Zone Updated successfully.");
                }
                else
                {
                    //zone.CreatedBy = _user.employee.Id;

                    LoginMaster u = new LoginMaster();
                    u.UserId = txtLoginId.Text.Trim();
                    u.Password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text.Trim(), "MD5");
                    u.Name = txtZoneName.Text.Trim();
                    u.Type = "Z";

                    using (TransactionScope scope = new TransactionScope())
                    {
                        zMethods.Add(zone);
                        users.Create(u);
                        scope.Complete();
                    }
                    js.ShowAlert(this, "Zone Created successfully.");

                    Response.Redirect("ZoneMaster.aspx", false);
                }
            }
            catch (Exception ex)
            {
                if (ex.InnerException.InnerException.Message.Contains("UNIQUE"))
                {
                    js.ShowAlert(this, "Login already exists! Please try another one.");
                }
                else
                {
                    js.ShowAlert(this, ex.Message);
                }
            }
        }
        public ActionResult LoginSalon(LoginMaster model)
        {
            if (SendDbUtility.ComparePasswordSalon(model.Password, model.Email))
            {
                FormsAuthentication.SetAuthCookie(model.Email, true);
                var salon = GetData.GetDataSalonAdmin(model.Email);
                Response.Cookies["ResidentName"].Value    = Server.UrlEncode(salon.ContactPerson);
                Response.Cookies["ResidentSurname"].Value = Server.UrlEncode(salon.SalonTitle);
                Response.Cookies["SalonId"].Value         = Server.UrlEncode(salon.Id.ToString());
                Response.Cookies["City"].Value            = Server.UrlEncode(salon.City);

                return(RedirectToAction("ShowBookedResidents", "TimerClub"));
            }
            return(RedirectToAction("MainPage", "TimerClub"));
        }
        public ActionResult LoginMaster(LoginMaster model)
        {
            if (SendDbUtility.ComparePassword(model.Password, model.Email))
            {
                FormsAuthentication.SetAuthCookie(model.Email, true);
                var resident = GetData.GetDataResident(model.Email);
                Response.Cookies["ResidentName"].Value    = Server.UrlEncode(resident.Name);
                Response.Cookies["ResidentSurname"].Value = Server.UrlEncode(resident.Surname);
                Response.Cookies["City"].Value            = Server.UrlEncode(resident.City);

                var cookie = new HttpCookie("SalonId")
                {
                    Expires = DateTime.Now.AddDays(-1d)
                };
                Response.Cookies.Add(cookie);

                return(RedirectToAction("FindWorkPlaces", "TimerClub"));
            }
            return(RedirectToAction("MainPage", "TimerClub"));
        }
示例#10
0
        public int loginonly([FromBody] LoginMaster l)
        {
            try
            {
                var usr = (from b in dc.GetTable <AuthorMaster>()
                           where b.mail == l.mail
                           where b.pass == l.pass
                           select b).SingleOrDefault();

                if (usr != null)
                {
                    return(usr.Id);
                }
                else
                {
                    return(-1);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public ActionResult Login(LoginMaster data)
        {
            try
            {
                var Logindata = db.LoginMasters.SingleOrDefault(a => a.LoginName == data.LoginName && a.LoginPassword == data.LoginPassword);
                if (Logindata != null)
                {
                    Session["adminId"] = Logindata.LoginId;
                    TempData["msg"]    = "Login Done!";

                    return(RedirectToAction("Index", "CategoryMasters"));
                }
                else
                {
                    TempData["err"] = "Username or Password is Wrong!!";
                }
            }
            catch (Exception ex)
            {
                TempData["err"] = ex.Message;
            }
            return(View());
        }
        public SuccessModel <LoginResponseModel> ValidateCustomer(LoginMaster loginUser)


        {
            try
            {
                var data = MasterHelperService.ValidatingUserForAll(loginUser, "CUSTOMER");
                if (data.Item1)
                {
                    var custData = GetCustomerById(data.Item2);
                    return(new SuccessModel <LoginResponseModel>()
                    {
                        Data = new LoginResponseModel()
                        {
                            Data = custData.Data, IsExist = data.Item1
                        }
                    });
                }
                else
                {
                    return(new SuccessModel <LoginResponseModel>()
                    {
                        Data = new LoginResponseModel()
                        {
                            IsExist = data.Item1, Data = null
                        }
                    });
                }
            }
            catch (Exception ex)
            {
                return(new SuccessModel <LoginResponseModel>()
                {
                    Data = null, ErrorMessage = ex.Message
                });
            }
        }
示例#13
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //var _user = Session["User"] as EmployeeWithTypeBranch;

            mDIVISION division = new mDIVISION();
            division.DIV_ENAME = txtDivisionName.Text.Trim();
            division.CIRCLE_ID = Convert.ToInt32(ddlCircle.SelectedValue);
            division.Mobileno = txtMobile.Text.Trim();

            division.officername = txtOfficerName.Text.Trim();
            division.Std = txtSTD.Text.Trim();
            division.Phoneno = txtPhoneNo.Text.Trim();
            division.faxno = txtFaxNo.Text.Trim();

            division.NoOfInstrument = Convert.ToInt32(txtInstrument.Text.Trim());
            division.InstrumentModel = txtModel.Text.Trim();

            try
            {
                if (Request["Code"] != null || ((MAPS.LoginMaster)Session["User"]).DistrictId != null)
                {
                    if (((MAPS.LoginMaster)Session["User"]).DistrictId != null)
                    {
                        division.DIV_ID = (int)((MAPS.LoginMaster)Session["User"]).DistrictId;
                    }
                    else
                    {
                        division.DIV_ID = Convert.ToInt32(Server.HtmlEncode(Request["Code"]).ToString());
                    }

                    division.Lastupdatedon = DateTime.Now;

                    dMethods.Update(division);
                    js.ShowAlert(this, "Divsion Updated successfully.");
                }
                else
                {
                    division.UpdateOn = DateTime.Now;

                    LoginMaster u = new LoginMaster();
                    u.UserId = txtLoginId.Text.Trim();
                    u.Password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text.Trim(), "MD5");
                    u.Name = txtOfficerName.Text.Trim();
                    u.Type = "D";

                    using (TransactionScope scope = new TransactionScope())
                    {
                        dMethods.Add(division);
                        users.Create(u);
                        scope.Complete();
                    }
                    js.ShowAlert(this, "Division Created successfully.");

                    Response.Redirect("DivisionMaster.aspx", false);
                }
            }
            catch (Exception ex)
            {
                if (ex.InnerException.InnerException.Message.Contains("UNIQUE"))
                {
                    js.ShowAlert(this, "Login already exists! Please try another one.");
                }
                else
                {
                    js.ShowAlert(this, ex.Message);
                }
            }
        }
示例#14
0
 public SuccessModel <LoginResponseModel> ValidateCustomer(LoginMaster loginUser)
 {
     NLogManager.Info("CustomerManager - Validating customer");
     return(_portalRepository.ValidateCustomer(loginUser));
 }
示例#15
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //var _user = Session["User"] as EmployeeWithTypeBranch;

            Block block = new Block();
            block.BlockName = txtBlockName.Text.Trim();
            block.RangeId = Convert.ToInt32(ddlRange.SelectedValue);
            if (ddlBeat.SelectedIndex > 0)
                block.SectionId = Convert.ToInt32(ddlSection.SelectedValue);
            block.MobileNo = txtMobile.Text.Trim();

            block.OfficerName = txtOfficerName.Text.Trim();
            block.STD = txtSTD.Text.Trim();
            block.PhoneNo = txtPhoneNo.Text.Trim();
            block.FaxNo = txtFaxNo.Text.Trim();

            try
            {
                if (Request["Code"] != null)
                {
                    block.Id = Convert.ToInt32(Server.HtmlEncode(Request["Code"]).ToString());

                    //zone.UpdatedBy = _user.employee.Id;
                    block.UpdatedDate = DateTime.Now;

                    bMethods.Update(block);
                    js.ShowAlert(this, "Block Updated successfully.");
                }
                else
                {
                    //zone.CreatedBy = _user.employee.Id;
                    block.CreatedDate = DateTime.Now;

                    LoginMaster u = new LoginMaster();
                    u.UserId = txtLoginId.Text.Trim();
                    u.Password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text.Trim(), "MD5");
                    u.Name = txtOfficerName.Text.Trim();
                    u.Type = "B";

                    using (TransactionScope scope = new TransactionScope())
                    {
                        bMethods.Add(block);
                        users.Create(u);
                        scope.Complete();
                    }
                    js.ShowAlert(this, "Block Created successfully.");

                    Response.Redirect("BlockMaster.aspx", false);
                }
            }
            catch (Exception ex)
            {
                if (ex.InnerException.InnerException.Message.Contains("UNIQUE"))
                {
                    js.ShowAlert(this, "Login already exists! Please try another one.");
                }
                else
                {
                    js.ShowAlert(this, ex.Message);
                }
            }
        }
 public SuccessModel <LoginResponseModel> ValidateCustomer(LoginMaster loginUser)
 {
     return(_portalManager.ValidateCustomer(loginUser));
 }