Ejemplo n.º 1
0
        public ActionResult Menu_edit(long id, ETMenu updateMenu)
        {
            TempData["messagealert"] = string.Empty;

            if (ModelState.IsValid)
            {
                Menu = new ETMenu();
                Menu = repMenu.GetMenu(id);

                if (repMenu.MenuIsExist(updateMenu.MenuName, id))
                {
                    ViewBag.messagealert = "Menu already exist";
                    return(View(Menu));
                }
                else
                {
                    Menu.MenuName                = updateMenu.MenuName;
                    Menu.MenuUrl                 = updateMenu.MenuUrl;
                    Menu.OrderNo                 = updateMenu.OrderNo;
                    Menu.Status                  = updateMenu.Status;
                    Menu.ModifiedBy              = Convert.ToInt64(Session["UserID"]);
                    Menu.ModifiedDate            = DateTime.Now;
                    dbEntities.Entry(Menu).State = EntityState.Modified;
                    dbEntities.SaveChanges();
                    if (Menu.MenuID != 0)
                    {
                        TempData["messagealert"] = Status.Update;
                    }
                }
                return(RedirectToAction("Index", "Menu"));
            }
            return(View());
        }
        public ActionResult Category_edit(long id, ETCategory updateCategory)
        {
            TempData["messagealert"] = string.Empty;

            if (ModelState.IsValid)
            {
                Category = new ETCategory();
                Category = repCategory.GetCategory(id);

                if (repCategory.CategoryIsExist(updateCategory.CategoryName, id))
                {
                    ViewBag.messagealert = "Category already exist";
                    ViewBag.Source       = repCategory.getSourceType();
                    return(View(Category));
                }
                else
                {
                    Category.CategoryName            = updateCategory.CategoryName;
                    Category.SourceID                = updateCategory.SourceID;
                    Category.IsActive                = updateCategory.IsActive;
                    Category.ModifiedBy              = Convert.ToInt64(Session["UserID"]);
                    Category.ModifiedDate            = DateTime.Now;
                    dbEntities.Entry(Category).State = EntityState.Modified;
                    dbEntities.SaveChanges();
                    if (Category.CategoryID != 0)
                    {
                        TempData["messagealert"] = Status.Update;
                    }
                }
                return(RedirectToAction("Index", "Category"));
            }
            return(View());
        }
Ejemplo n.º 3
0
        public ActionResult Source_edit(long id, ETSource updateSource)
        {
            TempData["messagealert"] = string.Empty;

            if (ModelState.IsValid)
            {
                Sourcee = new ETSource();
                Sourcee = repSource.GetSource(id);

                if (repSource.SourceIsExist(updateSource.SourceName, id))
                {
                    ViewBag.messagealert = "Source already exist";
                    ViewBag.SourceTypes  = repSource.getDataValues("SourceType", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    return(View(Sourcee));
                }
                else
                {
                    Sourcee.SourceName              = updateSource.SourceName;
                    Sourcee.SourceType              = updateSource.SourceType;
                    Sourcee.IsActive                = updateSource.IsActive;
                    Sourcee.ModifiedBy              = Convert.ToInt64(Session["UserID"]);
                    Sourcee.ModifiedDate            = DateTime.Now;
                    dbEntities.Entry(Sourcee).State = EntityState.Modified;
                    dbEntities.SaveChanges();
                    if (Sourcee.SourceID != 0)
                    {
                        TempData["messagealert"] = Status.Update;
                    }
                }
                return(RedirectToAction("Index", "Sources"));
            }
            return(View());
        }
Ejemplo n.º 4
0
        public ActionResult Role_edit(long id, ETRole updateRole)
        {
            TempData["messagealert"] = string.Empty;

            if (ModelState.IsValid)
            {
                Role = new ETRole();
                Role = repRole.GetRole(id);

                if (repRole.RoleIsExist(updateRole.RoleName, id))
                {
                    ViewBag.messagealert = "Role already exist";
                    return(View(Role));
                }
                else
                {
                    Role.RoleName                = updateRole.RoleName;
                    Role.IsActive                = updateRole.IsActive;
                    Role.ModifiedBy              = Convert.ToInt64(Session["UserID"]);
                    Role.ModifiedDate            = DateTime.Now;
                    dbEntities.Entry(Role).State = EntityState.Modified;
                    dbEntities.SaveChanges();
                    if (Role.RoleID != 0)
                    {
                        TempData["messagealert"] = Status.Update;
                    }
                }
                return(RedirectToAction("Index", "Role"));
            }
            return(View());
        }
Ejemplo n.º 5
0
        public ActionResult SubMenu_edit(long id, ETSubMenu updateSubMenu)
        {
            TempData["messagealert"] = string.Empty;

            if (ModelState.IsValid)
            {
                SubMenu = new ETSubMenu();
                SubMenu = repSubMenu.GetSubMenu(id);

                if (repSubMenu.SubMenuIsExist(updateSubMenu.SubMenuName, id))
                {
                    ViewBag.messagealert = "SubMenu already exist";
                    ViewBag.MenuList     = repSubMenu.getMenuType();
                    return(View(SubMenu));
                }
                else
                {
                    try
                    {
                        //SubMenu.MenuName = string.Empty;
                        SubMenu.MenuID                  = updateSubMenu.MenuID;
                        SubMenu.SubMenuName             = updateSubMenu.SubMenuName;
                        SubMenu.SubMenuUrl              = updateSubMenu.SubMenuUrl;
                        SubMenu.OrderNo                 = updateSubMenu.OrderNo;
                        SubMenu.Status                  = updateSubMenu.Status;
                        SubMenu.IsMainMenu              = updateSubMenu.IsMainMenu;
                        SubMenu.ModifiedBy              = Convert.ToInt64(Session["UserID"]);
                        SubMenu.ModifiedDate            = DateTime.Now;
                        dbEntities.Entry(SubMenu).State = EntityState.Modified;
                        dbEntities.SaveChanges();
                        if (SubMenu.SubMenuID != 0)
                        {
                            TempData["messagealert"] = Status.Update;
                        }
                    }
                    catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)
                    {
                        Exception raise = dbEx;
                        foreach (var validationErrors in dbEx.EntityValidationErrors)
                        {
                            foreach (var validationError in validationErrors.ValidationErrors)
                            {
                                string message = string.Format("{0}:{1}",
                                                               validationErrors.Entry.Entity.ToString(),
                                                               validationError.ErrorMessage);
                                // raise a new exception nesting
                                // the current instance as InnerException
                                raise = new InvalidOperationException(message, raise);
                            }
                        }
                        throw raise;
                    }
                }
                return(RedirectToAction("Index", "SubMenu"));
            }
            return(View());
        }
Ejemplo n.º 6
0
        public ActionResult Bank_edit(long id, ETBank updateBank)
        {
            TempData["messagealert"] = string.Empty;

            if (ModelState.IsValid)
            {
                Bank = new ETBank();
                Bank = repBank.GetBank(id);

                if (repBank.AccountNumberIsExist(updateBank.AccountNumber, id))
                {
                    ViewBag.messagealert = "Account Number already exist";
                    ViewBag.AccountTypes = repBank.getDataValues("AccountType", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    return(View(Bank));
                }
                else if (updateBank.CustomerID != null && updateBank.CustomerID != "" && repBank.CustomerIDIsExist(updateBank.CustomerID, id))
                {
                    ViewBag.messagealert = "Customer ID already exist";
                    ViewBag.AccountTypes = repBank.getDataValues("AccountType", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    return(View(Bank));
                }
                else if (repBank.BankEmailIsExist(updateBank.Email, Convert.ToInt64(Session["UserID"])) || !Common.IsValidEmail(updateBank.Email))
                {
                    if (!Common.IsValidEmail(updateBank.Email))
                    {
                        ViewBag.messagealert = "Please Enter Valid Email";
                    }
                    else
                    {
                        ViewBag.messagealert = "Email already exist";
                    }
                    ViewBag.AccountTypes = repBank.getDataValues("AccountType", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    return(View(Bank));
                }
                else
                {
                    Bank.AccountHolder      = updateBank.AccountHolder;
                    Bank.AccountNumber      = updateBank.AccountNumber;
                    Bank.IFSCCode           = updateBank.IFSCCode;
                    Bank.BankName           = updateBank.BankName;
                    Bank.BranchName         = updateBank.BranchName;
                    Bank.AccountType        = updateBank.AccountType;
                    Bank.MinimumBalance     = updateBank.MinimumBalance;
                    Bank.AccountOpeningDate = updateBank.AccountOpeningDate;
                    Bank.CustomerID         = updateBank.CustomerID;
                    Bank.Password           = updateBank.Password;
                    Bank.Email                   = updateBank.Email;
                    Bank.Phone                   = updateBank.Phone;
                    Bank.ATMNumber               = updateBank.ATMNumber;
                    Bank.PINNumber               = updateBank.PINNumber;
                    Bank.ExpiredDate             = updateBank.ExpiredDate;
                    Bank.CVV                     = updateBank.CVV;
                    Bank.IsCreditCard            = updateBank.IsCreditCard;
                    Bank.IsActive                = updateBank.IsActive;
                    Bank.ModifiedBy              = Convert.ToInt64(Session["UserID"]);
                    Bank.ModifiedDate            = DateTime.Now;
                    dbEntities.Entry(Bank).State = EntityState.Modified;
                    dbEntities.SaveChanges();
                    if (Bank.BankID != 0)
                    {
                        TempData["messagealert"] = Status.Update;
                    }
                }
                return(RedirectToAction("Index", "Bank"));
            }
            return(View());
        }
        public ActionResult Profiles(ProfileChange updateUser)
        {
            TempData["messagealert"] = string.Empty;
            var errors = ModelState.Values.SelectMany(v => v.Errors);

            if (ModelState.IsValid)
            {
                long userId = Convert.ToInt64(Session["UserID"]);
                UserVal = new ETUser();
                UserVal = repUsers.GetUser(userId);

                if (repUsers.LogInNameIsExist(updateUser.LoginName, userId))
                {
                    ViewBag.messagealert  = "LogInName already exist";
                    ViewBag.UserTitles    = repUsers.getDataValues("Title", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.Gender        = repUsers.getDataValues("Gender", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.MaritalStatus = repUsers.getDataValues("MaritalStatus", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.DeviceType    = repUsers.getDataValues("DeviceType", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    return(View(UserVal));
                }
                else if (repUsers.EmailIsExist(updateUser.Email, userId) || !Common.IsValidEmail(updateUser.Email))
                {
                    if (!Common.IsValidEmail(updateUser.Email))
                    {
                        ViewBag.messagealert = "Please Enter Valid Email";
                    }
                    else
                    {
                        ViewBag.messagealert = "Email already exist";
                    }
                    ViewBag.UserTitles    = repUsers.getDataValues("Title", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.Gender        = repUsers.getDataValues("Gender", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.MaritalStatus = repUsers.getDataValues("MaritalStatus", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.DeviceType    = repUsers.getDataValues("DeviceType", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    return(View(UserVal));
                }
                else if (repUsers.PhoneIsExist(updateUser.Phone, userId))
                {
                    ViewBag.messagealert  = "Phone already exist";
                    ViewBag.UserTitles    = repUsers.getDataValues("Title", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.Gender        = repUsers.getDataValues("Gender", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.MaritalStatus = repUsers.getDataValues("MaritalStatus", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.DeviceType    = repUsers.getDataValues("DeviceType", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    return(View(UserVal));
                }
                else
                {
                    //try
                    //{
                    UserVal.Title         = updateUser.Title;
                    UserVal.FirstName     = updateUser.FirstName;
                    UserVal.MiddleName    = updateUser.MiddleName;
                    UserVal.LastName      = updateUser.LastName;
                    UserVal.Email         = updateUser.Email;
                    UserVal.Phone         = updateUser.Phone;
                    UserVal.Gender        = updateUser.Gender;
                    UserVal.MaritalStatus = updateUser.MaritalStatus;
                    UserVal.DOB           = updateUser.DOB;
                    UserVal.Address       = updateUser.Address;
                    UserVal.LoginName     = updateUser.LoginName;
                    //UserVal.Password = UserVal.Password;
                    UserVal.ConfirmPassword = UserVal.Password;
                    //UserVal.UserLevel = UserVal.UserLevel;
                    UserVal.IsTwoFactor             = updateUser.IsTwoFactor;
                    UserVal.DeviceID                = updateUser.DeviceID;
                    UserVal.DeviceType              = updateUser.DeviceType;
                    UserVal.UserField1              = updateUser.UserField1;
                    UserVal.UserField2              = updateUser.UserField2;
                    UserVal.UserField3              = updateUser.UserField3;
                    UserVal.ModifiedBy              = Convert.ToInt64(Session["UserID"]);
                    UserVal.ModifiedDate            = DateTime.Now;
                    dbEntities.Entry(UserVal).State = EntityState.Modified;
                    dbEntities.SaveChanges();
                    if (UserVal.UserID != 0)
                    {
                        TempData["messagealert"] = Status.Update;
                    }
                    //}
                    //catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)
                    //{
                    //    Exception raise = dbEx;
                    //    foreach (var validationErrors in dbEx.EntityValidationErrors)
                    //    {
                    //        foreach (var validationError in validationErrors.ValidationErrors)
                    //        {
                    //            string message = string.Format("{0}:{1}",
                    //                validationErrors.Entry.Entity.ToString(),
                    //                validationError.ErrorMessage);
                    //            // raise a new exception nesting
                    //            // the current instance as InnerException
                    //            raise = new InvalidOperationException(message, raise);
                    //        }
                    //    }
                    //    throw raise;
                    //}
                }
                return(RedirectToAction("Index", "Home"));
            }
            return(View());
        }
Ejemplo n.º 8
0
        public ActionResult DirectLogin()
        {
            if (Request.QueryString["RandomID"] != null)
            {
                LoginDetail objLoginDetails = new LoginDetail();
                objLoginDetails.Email    = Common.DecryptPassword(Request.QueryString["RandomID"].ToString().Trim());
                objLoginDetails.Password = Common.DecryptPassword(Request.QueryString["RandomValue"].ToString().Trim());
                string VerifyMode = Common.DecryptPassword(Request.QueryString["VerifyMode"].ToString().Trim());
                if (Common.IsValidEmail(objLoginDetails.Email))
                {
                    objLoginDetails.GetTypes = "Email Id";
                }
                else
                {
                    objLoginDetails.GetTypes = "Usename";
                    if (dbEntities.ETUsers.Any(x => x.LoginName == objLoginDetails.Email))
                    {
                        objLoginDetails.Email = dbEntities.ETUsers.Where(x => x.LoginName == objLoginDetails.Email).Select(x => x.Email).First();
                    }
                }

                string DeviceType = "";
                if (VerifyMode == "Phone")
                {
                    DeviceType = "P";
                }
                else if (VerifyMode == "Email")
                {
                    DeviceType = "E";
                }

                LoginDetailCheck checkLogin = repUser.CheckLoginUserUsingOtp(objLoginDetails, DeviceType);
                if (checkLogin.isSuccess && checkLogin.errorMessage == "Valid")
                {
                    ETUser loginDetails = checkLogin.loginDetails;
                    if (loginDetails != null)
                    {
                        List <long> MappedUser = new List <long>();
                        Session["UserID"]        = loginDetails.UserID;
                        Session["UserName"]      = loginDetails.FirstName + " " + loginDetails.MiddleName + " " + loginDetails.LastName;
                        Session["RoleID"]        = loginDetails.RoleID;
                        Session["RoleName"]      = null;                   //loginDetails.ETRole.RoleName;
                        Session["LoginName"]     = loginDetails.LoginName; // New
                        Session["Email"]         = loginDetails.Email;
                        Session["Phone"]         = loginDetails.Phone;
                        Session["LastName"]      = loginDetails.LastName;
                        Session["IsTwoFactor"]   = loginDetails.IsTwoFactor;
                        Session["UserLevel"]     = loginDetails.UserLevel;
                        Session["ReportingUser"] = loginDetails.ReportingUser;
                        MappedUser            = dbEntities.ETUsers.Where(x => x.ReportingUser == loginDetails.UserID || x.UserID == loginDetails.UserID).Select(x => x.UserID).Distinct().ToList();
                        Session["MappedUser"] = MappedUser;
                        Session.Timeout       = 300;
                        repUser.LogForUserLogin(checkLogin, objLoginDetails.Email);
                        long UserId     = Convert.ToInt64(Session["UserID"]);
                        var  userVerify = dbEntities.ETUserVerifieds.Where(x => x.UserID == UserId && x.IsActive).FirstOrDefault();
                        if (userVerify != null && (!userVerify.IsEmailVefified || !userVerify.IsPhoneVerified))
                        {
                            if (VerifyMode == "Email")
                            {
                                userVerify.IsEmailVefified = true;
                            }
                            else if (VerifyMode == "Phone")
                            {
                                userVerify.IsPhoneVerified = true;
                            }
                            userVerify.ModifiedBy              = Convert.ToInt64(Session["UserID"]);
                            userVerify.ModifiedDate            = DateTime.Now;
                            dbEntities.Entry(userVerify).State = EntityState.Modified;
                            dbEntities.SaveChanges();
                        }

                        List <long> lstSubmenuId = dbEntities.ETMenuAccesses.Where(n => n.RoleID == loginDetails.RoleID && n.Status).Select(x => x.SubMenuID).ToList();
                        if (lstSubmenuId.Count > 0)
                        {
                            Session["IsVerifyTwofactor"] = "Y";
                            ETSubMenu objSubMenu = dbEntities.ETSubMenus.Where(n => lstSubmenuId.Contains(n.SubMenuID) && n.Status && n.IsMainMenu).OrderBy(x => x.OrderNo).FirstOrDefault();
                            string    Url        = objSubMenu.SubMenuUrl;
                            if (!string.IsNullOrEmpty(Url))
                            {
                                string[] urls = Url.Split('/');
                                if (urls[1] != "" && urls[2] != "")
                                {
                                    return(RedirectToAction(urls[2], urls[1]));
                                }
                            }
                        }
                    }
                }
                else if (checkLogin.errorMessage == "Otp")
                {
                    ViewBag.messagealert = "Otp Expired. Please try again.!";
                    return(RedirectToAction("Logout", "Login"));
                }
                else if (checkLogin.errorMessage == "Device")
                {
                    ViewBag.messagealert = "Your Device type is Invalid. Please try latest Device Link";
                    return(RedirectToAction("Logout", "Login"));
                }
                else if (checkLogin.errorMessage == "Invalid")
                {
                    ViewBag.messagealert = "Invalid OTP. Please Enter correct OTP and try again.!";
                    return(RedirectToAction("Logout", "Login"));
                }
                else
                {
                    ViewBag.Error        = checkLogin.errorMessage;
                    ViewBag.messagealert = checkLogin.errorMessage;
                    return(RedirectToAction("Logout", "Login"));
                }
            }
            ViewBag.messagealert = "Invalid Direct Login Url.";
            return(RedirectToAction("Logout", "Login"));
        }
Ejemplo n.º 9
0
        public ActionResult User_edit(long id, ETUser updateUser)
        {
            TempData["messagealert"] = string.Empty;
            //var errors = ModelState.Values.SelectMany(v => v.Errors);
            if (ModelState.IsValid)
            {
                Userval = new ETUser();
                Userval = repUsers.GetUser(id);

                if (repUsers.LogInNameIsExist(updateUser.LoginName, id))
                {
                    ViewBag.messagealert  = "LogInName already exist";
                    ViewBag.UserTitles    = repUsers.getDataValues("Title", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.Gender        = repUsers.getDataValues("Gender", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.MaritalStatus = repUsers.getDataValues("MaritalStatus", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.UserLevel     = repUsers.getDataValues("UserLevel", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.ReportingUser = repUsers.getMappedReportingUser();
                    ViewBag.DeviceType    = repUsers.getDataValues("DeviceType", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.Role          = repUsers.getRole();
                    return(View(Userval));
                }
                else if (repUsers.EmailIsExist(updateUser.Email, id) || !Common.IsValidEmail(updateUser.Email))
                {
                    if (!Common.IsValidEmail(updateUser.Email))
                    {
                        ViewBag.messagealert = "Please Enter Valid Email";
                    }
                    else
                    {
                        ViewBag.messagealert = "Email already exist";
                    }
                    ViewBag.UserTitles    = repUsers.getDataValues("Title", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.Gender        = repUsers.getDataValues("Gender", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.MaritalStatus = repUsers.getDataValues("MaritalStatus", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.UserLevel     = repUsers.getDataValues("UserLevel", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.ReportingUser = repUsers.getMappedReportingUser();
                    ViewBag.DeviceType    = repUsers.getDataValues("DeviceType", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.Role          = repUsers.getRole();
                    return(View(Userval));
                }
                else if (repUsers.PhoneIsExist(updateUser.Phone, id))
                {
                    ViewBag.messagealert  = "Phone already exist";
                    ViewBag.UserTitles    = repUsers.getDataValues("Title", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.Gender        = repUsers.getDataValues("Gender", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.MaritalStatus = repUsers.getDataValues("MaritalStatus", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.UserLevel     = repUsers.getDataValues("UserLevel", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.ReportingUser = repUsers.getMappedReportingUser();
                    ViewBag.DeviceType    = repUsers.getDataValues("DeviceType", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.Role          = repUsers.getRole();
                    return(View(Userval));
                }
                else
                {
                    long UserId = Convert.ToInt64(Session["UserID"]);
                    Userval.Title           = updateUser.Title;
                    Userval.FirstName       = updateUser.FirstName;
                    Userval.MiddleName      = updateUser.MiddleName;
                    Userval.LastName        = updateUser.LastName;
                    Userval.Email           = updateUser.Email;
                    Userval.Phone           = updateUser.Phone;
                    Userval.Gender          = updateUser.Gender;
                    Userval.MaritalStatus   = updateUser.MaritalStatus;
                    Userval.DOB             = updateUser.DOB;
                    Userval.Address         = updateUser.Address;
                    Userval.RoleID          = updateUser.RoleID;
                    Userval.LoginName       = updateUser.LoginName;
                    Userval.Password        = Common.EncryptPassword(updateUser.Password);
                    Userval.ConfirmPassword = Common.EncryptPassword(updateUser.ConfirmPassword);
                    //Userval.Password = updateUser.Password;
                    Userval.IsTwoFactor   = updateUser.IsTwoFactor;
                    Userval.UserLevel     = updateUser.UserLevel;
                    Userval.ReportingUser = updateUser.ReportingUser;
                    //Userval.IsOwner = updateUser.IsOwner;
                    //Userval.IsAdmin = updateUser.IsAdmin;
                    //Userval.IsManager = updateUser.IsManager;
                    Userval.IsActive                = updateUser.IsActive;
                    Userval.DeviceID                = updateUser.DeviceID;
                    Userval.DeviceType              = updateUser.DeviceType;
                    Userval.UserField1              = updateUser.UserField1;
                    Userval.UserField2              = updateUser.UserField2;
                    Userval.UserField3              = updateUser.UserField3;
                    Userval.ModifiedBy              = UserId;
                    Userval.ModifiedDate            = DateTime.Now;
                    dbEntities.Entry(Userval).State = EntityState.Modified;
                    dbEntities.SaveChanges();

                    var userVerify = dbEntities.ETUserVerifieds.Where(x => x.UserID == Userval.UserID && x.IsActive).FirstOrDefault();
                    if (userVerify == null)
                    {
                        ETUserVerified userVerified = new ETUserVerified();
                        userVerified.UserID           = Userval.UserID;
                        userVerified.IsEmailVefified  = false;
                        userVerified.IsPhoneVerified  = false;
                        userVerified.IsOtherVerified  = false;
                        userVerified.IsOtherVerified1 = false;
                        userVerified.IsOtherVerified2 = false;
                        userVerified.IsOtherVerified3 = false;
                        userVerified.IsActive         = true;
                        userVerified.CreatedBy        = UserId;
                        userVerified.CreatedDate      = DateTime.Now;
                        userVerified.ModifiedBy       = UserId;
                        userVerified.ModifiedDate     = DateTime.Now;
                        dbEntities.ETUserVerifieds.Add(userVerified);
                        dbEntities.SaveChanges();
                    }

                    if (Userval.UserID != 0)
                    {
                        TempData["messagealert"] = Status.Update;
                    }
                }
                return(RedirectToAction("Index", "User"));
            }
            return(View());
        }
Ejemplo n.º 10
0
        public ActionResult Land_Edit(long id, ETLandDetails updateLand)
        {
            TempData["messagealert"] = string.Empty;

            if (ModelState.IsValid)
            {
                if (string.IsNullOrEmpty(Convert.ToString(updateLand.AresSize)) && string.IsNullOrEmpty(Convert.ToString(updateLand.HectareSize)) && string.IsNullOrEmpty(Convert.ToString(updateLand.AcresSize)))
                {
                    ViewBag.messagealert = "Please Enter the Size of Land (Ares or Hectare or Acres).";
                    ViewBag.Districts    = repLand.getDataValues("District", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.Taluks       = repLand.getDataValues("Taluk", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.Divisions    = repLand.getDataValues("Division", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.Panchayats   = repLand.getDataValues("Panchayat", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.Villages     = repLand.getDataValues("Village", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.OwnerTypes   = repLand.getDataValues("OwnerType", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.LandTypes    = repLand.getDataValues("LandType", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    ViewBag.LandAreas    = repLand.getDataValues("LandArea", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                    return(View(updateLand));
                }
                else
                {
                    Land = new ETLandDetails();
                    Land = repLand.GetLand(id);

                    // Land Log
                    ETLandDetailsLog LandLog = new ETLandDetailsLog();
                    LandLog.LandID               = Land.LandID;
                    LandLog.District             = Land.District;
                    LandLog.Taluk                = Land.Taluk;
                    LandLog.Division             = Land.Division;
                    LandLog.Panchayat            = Land.Panchayat;
                    LandLog.Village              = Land.Village;
                    LandLog.OwnerType            = Land.OwnerType;
                    LandLog.LandType             = Land.LandType;
                    LandLog.LandArea             = Land.LandArea;
                    LandLog.PattaNumber          = Land.PattaNumber;
                    LandLog.PulaNumber           = Land.PulaNumber;
                    LandLog.SubDivisionNumber    = Land.SubDivisionNumber;
                    LandLog.OldSubDivisionNumber = Land.OldSubDivisionNumber;
                    LandLog.AcresSize            = Land.AcresSize;
                    LandLog.AresSize             = Land.AresSize;
                    LandLog.HectareSize          = Land.HectareSize;
                    LandLog.OwnerName            = Land.OwnerName;
                    LandLog.OwnerNameInTamil     = Land.OwnerNameInTamil;
                    LandLog.Remarks              = Land.Remarks;
                    LandLog.SourceType           = "U";
                    LandLog.IsActive             = Land.IsActive;
                    LandLog.IsOwned              = Land.IsOwned;
                    LandLog.IsCommon             = Land.IsCommon;
                    LandLog.IsVerified           = Land.IsVerified;
                    LandLog.UserID               = Land.UserID;
                    LandLog.CreatedDate          = Land.CreatedDate;
                    LandLog.CreatedUser          = Land.CreatedUser;
                    LandLog.ModifiedDate         = DateTime.Now;
                    LandLog.ModifiedUser         = Convert.ToInt64(Session["UserID"]);
                    dbEntities.ETLandDetailsLogs.Add(LandLog);

                    // Land Details
                    Land.District             = updateLand.District;
                    Land.Taluk                = updateLand.Taluk;
                    Land.Division             = updateLand.Division;
                    Land.Panchayat            = updateLand.Panchayat;
                    Land.Village              = updateLand.Village;
                    Land.OwnerType            = updateLand.OwnerType;
                    Land.LandType             = updateLand.LandType;
                    Land.LandArea             = updateLand.LandArea;
                    Land.PattaNumber          = updateLand.PattaNumber;
                    Land.PulaNumber           = updateLand.PulaNumber;
                    Land.SubDivisionNumber    = updateLand.SubDivisionNumber;
                    Land.OldSubDivisionNumber = updateLand.OldSubDivisionNumber;
                    //Land.AcresSize = updateLand.AcresSize;
                    //Land.AresSize = updateLand.AresSize;
                    //Land.HectareSize = updateLand.HectareSize;
                    Land.OwnerName        = updateLand.OwnerName;
                    Land.OwnerNameInTamil = updateLand.OwnerNameInTamil;
                    Land.Remarks          = updateLand.Remarks;
                    Land.IsActive         = updateLand.IsActive;
                    Land.IsOwned          = updateLand.IsOwned;
                    Land.IsCommon         = updateLand.IsCommon;
                    Land.IsVerified       = updateLand.IsVerified;
                    Land.ModifiedUser     = Convert.ToInt64(Session["UserID"]);
                    Land.ModifiedDate     = DateTime.Now;

                    if (updateLand.OwnerType == "Government")
                    {
                        Land.OldSubDivisionNumber = updateLand.PulaNumber + "-" + updateLand.SubDivisionNumber;
                        if (string.IsNullOrEmpty(Convert.ToString(updateLand.PattaNumber)))
                        {
                            Land.PattaNumber = "0";
                        }
                        if (string.IsNullOrEmpty(Convert.ToString(updateLand.AresSize)))
                        {
                            Land.AresSize = 0;
                        }
                        if (string.IsNullOrEmpty(Convert.ToString(updateLand.AcresSize)))
                        {
                            Land.AcresSize = 0;
                        }
                        if (string.IsNullOrEmpty(Convert.ToString(updateLand.HectareSize)))
                        {
                            Land.HectareSize = 0;
                        }
                        if (string.IsNullOrEmpty(Convert.ToString(updateLand.OwnerName)))
                        {
                            Land.OwnerName = "Government";
                        }
                        if (string.IsNullOrEmpty(Convert.ToString(updateLand.OwnerNameInTamil)))
                        {
                            Land.OwnerNameInTamil = "Government";
                        }
                        if (string.IsNullOrEmpty(Convert.ToString(updateLand.Remarks)))
                        {
                            Land.Remarks = "Government";
                        }
                    }
                    else if (string.IsNullOrEmpty(Convert.ToString(updateLand.PulaNumber)) || string.IsNullOrEmpty(Convert.ToString(updateLand.SubDivisionNumber)))
                    {
                        ViewBag.messagealert = "Please Enter the Pula or Sub Division Number.";
                        ViewBag.Districts    = repLand.getDataValues("District", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                        ViewBag.Taluks       = repLand.getDataValues("Taluk", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                        ViewBag.Divisions    = repLand.getDataValues("Division", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                        ViewBag.Panchayats   = repLand.getDataValues("Panchayat", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                        ViewBag.Villages     = repLand.getDataValues("Village", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                        ViewBag.OwnerTypes   = repLand.getDataValues("OwnerType", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                        ViewBag.LandTypes    = repLand.getDataValues("LandType", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                        ViewBag.LandAreas    = repLand.getDataValues("LandArea", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                        return(View(updateLand));
                    }
                    else if (string.IsNullOrEmpty(Convert.ToString(updateLand.PattaNumber)) || string.IsNullOrEmpty(Convert.ToString(updateLand.OldSubDivisionNumber)) || string.IsNullOrEmpty(Convert.ToString(updateLand.OwnerName)) || string.IsNullOrEmpty(Convert.ToString(updateLand.OwnerNameInTamil)))
                    {
                        ViewBag.messagealert = "Please Enter the Required Values.";
                        ViewBag.Districts    = repLand.getDataValues("District", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                        ViewBag.Taluks       = repLand.getDataValues("Taluk", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                        ViewBag.Divisions    = repLand.getDataValues("Division", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                        ViewBag.Panchayats   = repLand.getDataValues("Panchayat", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                        ViewBag.Villages     = repLand.getDataValues("Village", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                        ViewBag.OwnerTypes   = repLand.getDataValues("OwnerType", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                        ViewBag.LandTypes    = repLand.getDataValues("LandType", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                        ViewBag.LandAreas    = repLand.getDataValues("LandArea", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"]));
                        return(View(updateLand));
                    }

                    if (!string.IsNullOrEmpty(Convert.ToString(updateLand.AresSize)) && (string.IsNullOrEmpty(Convert.ToString(updateLand.HectareSize)) || string.IsNullOrEmpty(Convert.ToString(updateLand.AcresSize))))
                    {
                        Land.AresSize    = updateLand.AresSize;
                        Land.HectareSize = updateLand.AresSize / 100;
                        Land.AcresSize   = (Convert.ToDouble(updateLand.AresSize) * 0.0247105);
                    }
                    else if (!string.IsNullOrEmpty(Convert.ToString(updateLand.HectareSize)) && (string.IsNullOrEmpty(Convert.ToString(updateLand.AresSize)) || string.IsNullOrEmpty(Convert.ToString(updateLand.AcresSize))))
                    {
                        Land.HectareSize = updateLand.HectareSize;
                        Land.AresSize    = updateLand.HectareSize * 100;
                        Land.AcresSize   = (Convert.ToDouble(updateLand.HectareSize) * 2.47105);
                    }
                    else if (!string.IsNullOrEmpty(Convert.ToString(updateLand.AcresSize)) && (string.IsNullOrEmpty(Convert.ToString(updateLand.HectareSize)) || string.IsNullOrEmpty(Convert.ToString(updateLand.AresSize))))
                    {
                        Land.AcresSize   = updateLand.AcresSize;
                        Land.AresSize    = (Convert.ToDouble(updateLand.AcresSize) / 0.0247105);
                        Land.HectareSize = (Convert.ToDouble(updateLand.AcresSize) / 2.47105);
                    }
                    else
                    {
                        Land.AcresSize   = updateLand.AcresSize;
                        Land.AresSize    = updateLand.AresSize;
                        Land.HectareSize = updateLand.HectareSize;
                    }

                    dbEntities.Entry(Land).State = EntityState.Modified;
                    dbEntities.SaveChanges();
                    if (Land.LandID != 0)
                    {
                        TempData["messagealert"] = Status.Update;
                    }
                }
                return(RedirectToAction("Index", "Land"));
            }
            return(View());
        }