public ActionResult Category_add(ETCategory Category) { TempData["messagealert"] = string.Empty; ViewBag.messagealert = string.Empty; if (ModelState.IsValid) { if (Category != null) { if (repCategory.CategoryIsExist(Category.CategoryName, 0)) { ViewBag.messagealert = "Category already exist"; ViewBag.Source = repCategory.getSourceType(); return(View(Category)); } else { Category.UserID = Convert.ToInt64(Session["UserID"]); Category.CreatedBy = Convert.ToInt64(Session["UserID"]); Category.CreatedDate = DateTime.Now; Category.ModifiedBy = Convert.ToInt64(Session["UserID"]); Category.ModifiedDate = DateTime.Now; dbEntities.ETCategories.Add(Category); dbEntities.SaveChanges(); if (Category.CategoryID != 0) { TempData["messagealert"] = Status.Save; } } } return(RedirectToAction("Index", "Category")); } return(View()); }
public ActionResult Menu_add(ETMenu Menu) { TempData["messagealert"] = string.Empty; ViewBag.messagealert = string.Empty; if (ModelState.IsValid) { if (Menu != null) { if (repMenu.MenuIsExist(Menu.MenuName, 0)) { ViewBag.messagealert = "Menu already exist"; return(View(Menu)); } else { Menu.CreatedBy = Convert.ToInt64(Session["UserID"]); Menu.CreatedDate = DateTime.Now; Menu.ModifiedBy = Convert.ToInt64(Session["UserID"]); Menu.ModifiedDate = DateTime.Now; dbEntities.ETMenus.Add(Menu); dbEntities.SaveChanges(); if (Menu.MenuID != 0) { TempData["messagealert"] = Status.Save; } } } return(RedirectToAction("Index", "Menu")); } return(View()); }
public ActionResult Source_add(ETSource Source) { TempData["messagealert"] = string.Empty; ViewBag.messagealert = string.Empty; if (ModelState.IsValid) { if (Source != null) { if (repSource.SourceIsExist(Source.SourceName, 0)) { ViewBag.messagealert = "Source already exist"; ViewBag.SourceTypes = repSource.getDataValues("SourceType", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"])); return(View(Source)); } else { Source.UserID = Convert.ToInt64(Session["UserID"]); Source.CreatedBy = Convert.ToInt64(Session["UserID"]); Source.CreatedDate = DateTime.Now; Source.ModifiedBy = Convert.ToInt64(Session["UserID"]); Source.ModifiedDate = DateTime.Now; dbEntities.ETSources.Add(Source); dbEntities.SaveChanges(); if (Source.SourceID != 0) { TempData["messagealert"] = Status.Save; } } } return(RedirectToAction("Index", "Sources")); } return(View()); }
public ActionResult Bank_add(ETBank Bank) { TempData["messagealert"] = string.Empty; ViewBag.messagealert = string.Empty; if (ModelState.IsValid) { if (Bank != null) { if (repBank.AccountNumberIsExist(Bank.AccountNumber, 0)) { 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 (Bank.CustomerID != null && Bank.CustomerID != "" && repBank.CustomerIDIsExist(Bank.CustomerID, 0)) { 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(Bank.Email, Convert.ToInt64(Session["UserID"])) || !Common.IsValidEmail(Bank.Email)) { if (!Common.IsValidEmail(Bank.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.UserID = Convert.ToInt64(Session["UserID"]); Bank.CreatedBy = Convert.ToInt64(Session["UserID"]); Bank.CreatedDate = DateTime.Now; Bank.ModifiedBy = Convert.ToInt64(Session["UserID"]); Bank.ModifiedDate = DateTime.Now; dbEntities.ETBanks.Add(Bank); dbEntities.SaveChanges(); if (Bank.BankID != 0) { TempData["messagealert"] = Status.Save; } } } return(RedirectToAction("Index", "Bank")); } return(View()); }
public ActionResult Role_add(ETRole Role) { TempData["messagealert"] = string.Empty; ViewBag.messagealert = string.Empty; if (ModelState.IsValid) { if (Role != null) { if (repRole.RoleIsExist(Role.RoleName, 0)) { ViewBag.messagealert = "Role already exist"; return(View(Role)); } else { Role.CreatedBy = Convert.ToInt64(Session["UserID"]); Role.CreatedDate = DateTime.Now; Role.ModifiedBy = Convert.ToInt64(Session["UserID"]); Role.ModifiedDate = DateTime.Now; dbEntities.ETRoles.Add(Role); dbEntities.SaveChanges(); if (Role.RoleID != 0) { TempData["messagealert"] = Status.Save; } } } return(RedirectToAction("Index", "Role")); } 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()); }
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")); }
public ActionResult User_add(ETUser addUser) { TempData["messagealert"] = string.Empty; ViewBag.messagealert = string.Empty; if (ModelState.IsValid) { if (addUser != null) { if (repUsers.LogInNameIsExist(addUser.LoginName, 0)) { 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(addUser)); } else if (repUsers.EmailIsExist(addUser.Email, 0) || !Common.IsValidEmail(addUser.Email)) { if (!Common.IsValidEmail(addUser.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(addUser)); } else if (repUsers.PhoneIsExist(addUser.Phone, 0)) { 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(addUser)); } else { //try //{ addUser.SourceOfCreation = "User Form"; addUser.Password = Common.EncryptPassword(addUser.Password); addUser.ConfirmPassword = Common.EncryptPassword(addUser.ConfirmPassword); addUser.UserID = repUsers.UserIdGeneration(); addUser.CreatedBy = Convert.ToInt64(Session["UserID"]); addUser.CreatedDate = DateTime.Now; addUser.ModifiedBy = Convert.ToInt64(Session["UserID"]); addUser.ModifiedDate = DateTime.Now; dbEntities.ETUsers.Add(addUser); dbEntities.SaveChanges(); ETUserVerified userVerified = new ETUserVerified(); userVerified.UserID = addUser.UserID; userVerified.IsEmailVefified = false; userVerified.IsPhoneVerified = false; userVerified.IsOtherVerified = false; userVerified.IsOtherVerified1 = false; userVerified.IsOtherVerified2 = false; userVerified.IsOtherVerified3 = false; userVerified.IsActive = true; userVerified.CreatedBy = Convert.ToInt64(Session["UserID"]); userVerified.CreatedDate = DateTime.Now; userVerified.ModifiedBy = Convert.ToInt64(Session["UserID"]); userVerified.ModifiedDate = DateTime.Now; dbEntities.ETUserVerifieds.Add(userVerified); dbEntities.SaveChanges(); if (addUser.UserID != 0) { TempData["messagealert"] = Status.Save; } //} //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", "User")); } return(View()); }
public ActionResult Land_Add(ETLandDetails Land) { TempData["messagealert"] = string.Empty; ViewBag.messagealert = string.Empty; if (ModelState.IsValid) { if (Land != null) { //if (repLand.AccountNumberIsExist(Land.AccountNumber, 0)) //{ // ViewBag.messagealert = "Account Number already exist"; // ViewBag.AccountTypes = repLand.getDataValues("AccountType", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"])); // return View(Land); //} //else if (Land.CustomerID != null && Land.CustomerID != "" && repLand.CustomerIDIsExist(Land.CustomerID, 0)) //{ // ViewBag.messagealert = "Customer ID already exist"; // ViewBag.AccountTypes = repLand.getDataValues("AccountType", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"])); // return View(Land); //} //else if (repLand.LandEmailIsExist(Land.Email, Convert.ToInt64(Session["UserID"])) || !Common.IsValidEmail(Land.Email)) //{ // if (!Common.IsValidEmail(Land.Email)) // ViewBag.messagealert = "Please Enter Valid Email"; // else // ViewBag.messagealert = "Email already exist"; // ViewBag.AccountTypes = repLand.getDataValues("AccountType", Session["UserLevel"].ToString(), Convert.ToInt64(Session["UserID"]), Convert.ToInt64(Session["ReportingUser"])); // return View(Land); //} if (Land.OwnerType == "Government") { Land.OldSubDivisionNumber = Land.PulaNumber + "-" + Land.SubDivisionNumber; if (string.IsNullOrEmpty(Convert.ToString(Land.PattaNumber))) { Land.PattaNumber = "0"; } if (string.IsNullOrEmpty(Convert.ToString(Land.AresSize))) { Land.AresSize = 0; } if (string.IsNullOrEmpty(Convert.ToString(Land.AcresSize))) { Land.AcresSize = 0; } if (string.IsNullOrEmpty(Convert.ToString(Land.HectareSize))) { Land.HectareSize = 0; } if (string.IsNullOrEmpty(Convert.ToString(Land.OwnerName))) { Land.OwnerName = "Government"; } if (string.IsNullOrEmpty(Convert.ToString(Land.OwnerNameInTamil))) { Land.OwnerNameInTamil = "Government"; } if (string.IsNullOrEmpty(Convert.ToString(Land.Remarks))) { Land.Remarks = "Government"; } } else if (string.IsNullOrEmpty(Convert.ToString(Land.PulaNumber)) || string.IsNullOrEmpty(Convert.ToString(Land.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(Land)); } else if (string.IsNullOrEmpty(Convert.ToString(Land.PattaNumber)) || string.IsNullOrEmpty(Convert.ToString(Land.OwnerName)) || string.IsNullOrEmpty(Convert.ToString(Land.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(Land)); } if (string.IsNullOrEmpty(Convert.ToString(Land.AresSize)) && string.IsNullOrEmpty(Convert.ToString(Land.HectareSize)) && string.IsNullOrEmpty(Convert.ToString(Land.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(Land)); } else { if (!string.IsNullOrEmpty(Convert.ToString(Land.AresSize)) && (string.IsNullOrEmpty(Convert.ToString(Land.HectareSize)) || string.IsNullOrEmpty(Convert.ToString(Land.AcresSize)))) { Land.HectareSize = Land.AresSize / 100; Land.AcresSize = (Convert.ToDouble(Land.AresSize) * 0.0247105); } if (!string.IsNullOrEmpty(Convert.ToString(Land.HectareSize)) && (string.IsNullOrEmpty(Convert.ToString(Land.AresSize)) || string.IsNullOrEmpty(Convert.ToString(Land.AcresSize)))) { Land.AresSize = Land.HectareSize * 100; Land.AcresSize = (Convert.ToDouble(Land.HectareSize) * 2.47105); } if (!string.IsNullOrEmpty(Convert.ToString(Land.AcresSize)) && (string.IsNullOrEmpty(Convert.ToString(Land.HectareSize)) || string.IsNullOrEmpty(Convert.ToString(Land.AresSize)))) { Land.AresSize = (Convert.ToDouble(Land.AcresSize) / 0.0247105); Land.HectareSize = (Convert.ToDouble(Land.AcresSize) / 2.47105); } Land.UserID = Convert.ToInt64(Session["UserID"]); Land.CreatedUser = Convert.ToInt64(Session["UserID"]); Land.CreatedDate = DateTime.Now; Land.ModifiedUser = Convert.ToInt64(Session["UserID"]); Land.ModifiedDate = DateTime.Now; if (string.IsNullOrEmpty(Convert.ToString(Land.OldSubDivisionNumber))) { Land.OldSubDivisionNumber = Land.PulaNumber + "-" + Land.SubDivisionNumber; } dbEntities.ETLandDetail.Add(Land); // 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; if (string.IsNullOrEmpty(Convert.ToString(Land.OldSubDivisionNumber))) { LandLog.OldSubDivisionNumber = Land.PulaNumber + "-" + Land.SubDivisionNumber; } else { 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 = "C"; 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 = Land.ModifiedDate; LandLog.ModifiedUser = Land.ModifiedUser; dbEntities.ETLandDetailsLogs.Add(LandLog); dbEntities.SaveChanges(); if (Land.LandID != 0) { TempData["messagealert"] = Status.Save; } } } return(RedirectToAction("Index", "Land")); } return(View()); }