Esempio n. 1
0
        public JsonResult AddPermission(string moduleName, string moduleStatus, string email, string finalRights, string iconname, string assignrightcode)
        {
            var userDetails = _iemployeeservice.getEmpByEmail(email);

            string[] names      = moduleName.Split('$');
            string[] status     = moduleStatus.Split('$');
            string[] rights     = finalRights.Split('$');
            string[] icons      = iconname.Split('$');
            string[] assigncode = assignrightcode.Split('$');

            for (int i = 0; i < (names.Length - 1); i++)
            {
                UserCredential temp = new UserCredential();
                temp.Email   = email;
                temp.UseName = userDetails.Name;
                temp.Modules = names[i];
                temp.Status  = status[i];
                temp.Icon    = icons[i];
                if (assigncode[i] == "")
                {
                    temp.AssignRightsCode = null;
                }
                else
                {
                    temp.AssignRightsCode = assigncode[i];
                }
                temp.ModuleRights = rights[i];
                temp.ModuleId     = _imoduleservice.getModuleIdByModulename(names[i]);

                //FOR SAVE DASHBOARD ID WHEN ASSIGN USER CREDENTIAL
                if (temp.Status == null)
                {
                    temp.Status = "";
                }

                if (temp.Status != "")
                {
                    var DashId = _imoduleservice.GetDataByModuleId(temp.ModuleId).DashboardId;
                    temp.AssignDashboardId = DashId;
                }
                else
                {
                    temp.AssignDashboardId = "";
                }
                _iusercredentailservice.CreateUserCredential(temp);
            }
            return(Json("success", JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public ActionResult ReplicateTheValues()
        {
            string procname = "TruncateTable";

            _CompanyService.TruncateTable(procname);

            //Replicate The Bank Master Values
            var BankMasters = TempData["BankMasters"] as IEnumerable <BankMaster>;

            foreach (var Bank in BankMasters)
            {
                Bank.modifiedon = DateTime.Now;
                _BankService.CreateBank(Bank);
            }

            //Replicate The Client Master Values
            var ClientMasters = TempData["ClientMasters"] as IEnumerable <ClientMaster>;

            foreach (var Client in ClientMasters)
            {
                Client.ModifiedOn = DateTime.Now;
                _ClientMasterService.CreateClient(Client);
            }

            //Replicate The Client Bank Values
            var ClientBanks = TempData["ClientBanks"] as IEnumerable <ClientBankDetail>;

            foreach (var Bank in ClientBanks)
            {
                Bank.ModifiedOn = DateTime.Now;
                _ClientBankDetailService.CreateBankDetails(Bank);
            }

            //Replicate The Designation Master Values
            var DesignationMasters = TempData["DesignationMasters"] as IEnumerable <DesignationMaster>;

            foreach (var Designation in DesignationMasters)
            {
                Designation.ModifiedOn = DateTime.Now;
                _DesignationMasterService.Create(Designation);
            }

            //Replicate The Design Master Values
            var DesignMasters = TempData["DesignMasters"] as IEnumerable <DesignMaster>;

            foreach (var Design in DesignMasters)
            {
                Design.ModifiedOn = DateTime.Now;
                _DesignService.CreateDesign(Design);
            }

            //Replicate The Brand Master Values
            var BrandMasters = TempData["BrandMasters"] as IEnumerable <BrandMaster>;

            foreach (var Brand in BrandMasters)
            {
                Brand.ModifiedOn = DateTime.Now;
                _BrandMasterService.Create(Brand);
            }

            //Replicate The Employee Master Values
            var EmployeeMasters = TempData["EmployeeMasters"] as IEnumerable <EmployeeMaster>;

            foreach (var Employee in EmployeeMasters)
            {
                Employee.ModifiedOn = DateTime.Now;
                _EmployeeMasterService.CreateEmployee(Employee);
            }

            //Replicate The Godown Master Values
            var GodownMasters = TempData["GodownMasters"] as IEnumerable <GodownMaster>;

            foreach (var Godown in GodownMasters)
            {
                Godown.ModifiedOn = DateTime.Now;
                _GodownService.CreateGodown(Godown);
            }

            //Replicate The Godown Address Values
            var GodownAddresses = TempData["GodownAddresses"] as IEnumerable <GodownAddress>;

            foreach (var Address in GodownAddresses)
            {
                _GodownAddressService.CreateGoDown(Address);
            }

            //Replicate The Item Category Values
            var ItemCategory = TempData["ItemCategory"] as IEnumerable <ItemCategory>;

            foreach (var Category in ItemCategory)
            {
                Category.ModifiedOn = DateTime.Now;
                _ItemCategoryService.CreateItemCatgory(Category);
            }

            //Replicate The Item SubCategory Values
            var ItemSubCategory = TempData["ItemSubCategory"] as IEnumerable <ItemSubCategory>;

            foreach (var SubCategory in ItemSubCategory)
            {
                SubCategory.ModifiedOn = DateTime.Now;
                _ItemSubCategoryService.CreateItemCatgory(SubCategory);
            }

            //Replicate The Item Master Values
            var ItemMasters = TempData["ItemMasters"] as IEnumerable <Item>;

            foreach (var Item in ItemMasters)
            {
                Item.modifedOn = DateTime.Now;
                _ItemService.createItem(Item);
            }

            //Replicate The Non Inventory Item Values
            var NonInventoryItems = TempData["NonInventoryItems"] as IEnumerable <NonInventoryItem>;

            foreach (var NonInventoryItem in NonInventoryItems)
            {
                NonInventoryItem.modifedOn = DateTime.Now;
                _NonInventoryItemService.createNonInventoryItem(NonInventoryItem);
            }

            //Replicate The Barcode Numbers Values
            var Barcodes = TempData["BarcodeNumbers"] as IEnumerable <BarcodeNumber>;

            foreach (var Barcode in Barcodes)
            {
                _BarcodeNumberService.CreateBarcode(Barcode);
            }

            //Replicate The Job Worker Values
            var JobWorkers = TempData["JobWorkers"] as IEnumerable <JobWorker>;

            foreach (var JobWorker in JobWorkers)
            {
                JobWorker.ModifiedOn = DateTime.Now;
                _JobWorkerService.Create(JobWorker);
            }

            //Replicate The Job Worker Type Values
            var JobWorkerTypes = TempData["JobWorkerTypes"] as IEnumerable <JobWorkType>;

            foreach (var JobWorkerType in JobWorkerTypes)
            {
                JobWorkerType.ModifiedOn = DateTime.Now;
                _JobWorkTypeService.Create(JobWorkerType);
            }

            ////Replicate The Sales Incentives Values
            //var SalesIncentives = TempData["SalesIncentives"] as IEnumerable<SalesIncentiveMaster>;
            //foreach (var SalesIncentive in SalesIncentives)
            //{
            //    SalesIncentive.ModifiedOn = DateTime.Now;
            //    _SalesIncentiveService.CreateSI(SalesIncentive);
            //}

            //Replicate The Shop Master Values
            var ShopMasters = TempData["ShopMasters"] as IEnumerable <ShopMaster>;

            foreach (var Shop in ShopMasters)
            {
                Shop.ModifiedOn = DateTime.Now;
                _ShopService.Create(Shop);
            }

            //Replicate The Type Of Material Values
            var TypeOfMaterials = TempData["TypeOfMaterials"] as IEnumerable <TypeOfMaterial>;

            foreach (var Material in TypeOfMaterials)
            {
                Material.ModifiedOn = DateTime.Now;
                _TypeOfMaterialService.AddTypeOfMaterial(Material);
            }

            //Replicate The Unit Master Values
            var UnitMasters = TempData["UnitMasters"] as IEnumerable <UnitMaster>;

            foreach (var Unit in UnitMasters)
            {
                Unit.modifiedOn = DateTime.Now;
                _UnitService.createunit(Unit);
            }

            //Replicate The Supplier Master Values
            var SupplierMasters = TempData["SupplierMasters"] as IEnumerable <SupplierMaster>;

            foreach (var Supplier in SupplierMasters)
            {
                Supplier.ModifiedOn = DateTime.Now;
                _SuppliersMasterService.CreateSupplier(Supplier);
            }

            //Replicate The Supplier Bank Values
            var SupplierBanks = TempData["SupplierBanks"] as IEnumerable <SupplierBankDetail>;

            foreach (var Bank in SupplierBanks)
            {
                Bank.ModifiedOn = DateTime.Now;
                _SupplierBankDetailService.CreateBankDetails(Bank);
            }

            //Replicate The Transport Master Values
            var TransportMasters = TempData["TransportMasters"] as IEnumerable <TransportMaster>;

            foreach (var Transport in TransportMasters)
            {
                Transport.ModifiedOn = DateTime.Now;
                _TransportService.CreateTransport(Transport);
            }

            //Replicate The Tranport Bank Values
            var TransportBanks = TempData["TransportBanks"] as IEnumerable <TransportBankDetail>;

            foreach (var Bank in TransportBanks)
            {
                Bank.ModifiedOn = DateTime.Now;
                _TransportBankDetailService.CreateBankDetails(Bank);
            }

            //Replicate The User Values
            var Users = TempData["Users"] as IEnumerable <User>;

            foreach (var User in Users)
            {
                User.ModifiedBy = DateTime.Now;
                _UserService.CreateUser(User);
            }

            //Replicate The Commission Master Values
            var CommissionMasters = TempData["CommissionMasters"] as IEnumerable <CommissionMaster>;

            foreach (var Commission in CommissionMasters)
            {
                Commission.ModifiedOn = DateTime.Now;
                _CommissionService.Create(Commission);
            }

            //Replicate The Module Values
            var Modules = TempData["Modules"] as IEnumerable <Module>;

            foreach (var module in Modules)
            {
                _ModuleService.CreateModule(module);
            }

            //Replicate The UserCredential Values
            var UserCredentials = TempData["UserCredentials"] as IEnumerable <UserCredential>;

            foreach (var usercredential in UserCredentials)
            {
                _UserCredentialService.CreateUserCredential(usercredential);
            }

            //Replicate The Employee Company Values
            var EmployeeCompanies = TempData["EmployeeCompanies"] as IEnumerable <EmployeesCompany>;

            foreach (var EmpComp in EmployeeCompanies)
            {
                _EmployeesCompanyService.Create(EmpComp);
            }

            //CompanyCode = "RetailManagement";
            //CompanyName = "RetailManagement";
            //DatabaseName = "RetailManagement";
            CompanyCode  = "A2ZRetail";
            CompanyName  = "A2ZRetail";
            DatabaseName = "A2ZRetail";
            return(RedirectToAction("ReplicationDone"));
        }
Esempio n. 3
0
        public ActionResult Create(MainApplication mainapp)
        {
            var shopmaster = _shopService.GetLastShop();
            int shopVal    = 0;
            int length     = 0;

            if (shopmaster != null)
            {
                shopVal = shopmaster.ShopId;
                shopVal = shopVal + 1;
                length  = shopVal.ToString().Length;
            }
            else
            {
                shopVal = 1;
                length  = 1;
            }
            string shopCode = _utilityService.getName("SH", length, shopVal);

            mainapp.ShopDetails.ShopCode   = shopCode;
            mainapp.ShopDetails.Status     = "Active";
            mainapp.ShopDetails.ModifiedOn = DateTime.Now;
            _shopService.Create(mainapp.ShopDetails);

            //SAVE SHOP IN USERCREDENTIAL AND MODULES
            Module         modulesdetails        = new Module();
            UserCredential usercredentialdetails = new UserCredential();

            modulesdetails.ModuleName       = mainapp.ShopDetails.ShopName;
            modulesdetails.ModuleRights     = "Add";
            modulesdetails.AssignRightsCode = shopCode;

            int LastRowPrimaryKey = _iIModuleService.GetLastRow().Id;
            int actualdashboardID = LastRowPrimaryKey + 1;

            modulesdetails.DashboardId = "D" + actualdashboardID;
            _iIModuleService.CreateModule(modulesdetails);

            var username      = HttpContext.Session["UserName"].ToString();
            var lastmodulerow = _iIModuleService.GetLastRow();

            //IF SUPERADMIN CREATE THE SHOP THEN MAKE THE ENTRY FOR SUPERADMIN ONLY..
            if (username == "SuperAdmin")
            {
                usercredentialdetails.ModuleId     = lastmodulerow.Id;
                usercredentialdetails.Modules      = mainapp.ShopDetails.ShopName;
                usercredentialdetails.ModuleRights = "Add";
                usercredentialdetails.UseName      = username;
                usercredentialdetails.Email        = UserEmail;
                usercredentialdetails.Status       = "add";
                _IUserCredentialService.CreateUserCredential(usercredentialdetails);

                string query = "GetUsersEmail";
                var    list  = _shopService.GetUserEmails(query);
                foreach (var data in list)
                {
                    var userdetails = _IUserCredentialService.GetByEmail(data.Email);
                    usercredentialdetails.ModuleId         = lastmodulerow.Id;
                    usercredentialdetails.Modules          = mainapp.ShopDetails.ShopName;
                    usercredentialdetails.ModuleRights     = "Add";
                    usercredentialdetails.UseName          = userdetails.UseName;
                    usercredentialdetails.Email            = data.Email;
                    usercredentialdetails.Status           = "";
                    usercredentialdetails.AssignRightsCode = shopCode;
                    _IUserCredentialService.CreateUserCredential(usercredentialdetails);
                }
            }
            //IF ANY OTHER EMPLOYEE CREATE THE SHOP THEN MAKE THE ENTRY FOR SUPERADMIN + EMPLOYEE..
            else
            {
                //IF EXCEPT SUPERADMIN ADD SHOP THEN IT WELL DISPLAY ALL EMPLOYEE IN USERCREDENTIAL
                string query = "GetUsersEmail";
                var    list  = _shopService.GetUserEmails(query);
                foreach (var data in list)
                {
                    var userdetails = _IUserCredentialService.GetByEmail(data.Email);
                    usercredentialdetails.ModuleId         = lastmodulerow.Id;
                    usercredentialdetails.Modules          = mainapp.ShopDetails.ShopName;
                    usercredentialdetails.ModuleRights     = "Add";
                    usercredentialdetails.UseName          = userdetails.UseName;
                    usercredentialdetails.Email            = data.Email;
                    usercredentialdetails.Status           = "";
                    usercredentialdetails.AssignRightsCode = shopCode;
                    _IUserCredentialService.CreateUserCredential(usercredentialdetails);
                }

                usercredentialdetails.AssignRightsCode = null;
                usercredentialdetails.Status           = "add";
                usercredentialdetails.UseName          = "SuperAdmin";
                usercredentialdetails.Email            = "*****@*****.**";
                _IUserCredentialService.CreateUserCredential(usercredentialdetails);
            }
            var lastrow = _shopService.GetLastShop();
            var ShopId  = Encode(lastrow.ShopId.ToString());

            return(RedirectToAction("CreateDetails/" + ShopId, "Shop"));
        }
Esempio n. 4
0
        public ActionResult Create(MainApplication mainapp)
        {
            MainApplication model = new MainApplication()
            {
                GodownDetails = new GodownMaster(),
            };
            var details = _godownService.getGodownLast();
            int lastid  = 0;
            int length  = 0;

            if (details != null)
            {
                lastid = details.GodownId;
                lastid = lastid + 1;
                length = lastid.ToString().Length;
            }
            else
            {
                lastid = 1;
                length = 1;
            }
            string Godowncode = _utilityService.getName("GD", length, lastid);

            mainapp.GodownDetails.Status     = "Active";
            mainapp.GodownDetails.ModifiedOn = DateTime.Now;
            int empid   = Convert.ToInt32(mainapp.GodownDetails.EmpName);
            var emplist = _employeemasterService.getEmpById(empid);

            mainapp.GodownDetails.EmpName = emplist.Name;
            _godownService.CreateGodown(mainapp.GodownDetails);
            mainapp.GodownAddressDetails.GdCode = Godowncode;
            _godownaddresService.CreateGoDown(mainapp.GodownAddressDetails);
            var GodownDetails = _godownService.getGodownLast();

            //SAVE SHOP IN USERCREDENTIAL AND MODULES
            Module         modulesdetails        = new Module();
            UserCredential usercredentialdetails = new UserCredential();

            modulesdetails.ModuleName       = mainapp.GodownDetails.GodownName;
            modulesdetails.ModuleRights     = "Add";
            modulesdetails.AssignRightsCode = Godowncode;

            int LastRowPrimaryKey = _iIModuleService.GetLastRow().Id;
            int actualdashboardID = LastRowPrimaryKey + 1;

            modulesdetails.DashboardId = "D" + actualdashboardID;
            _iIModuleService.CreateModule(modulesdetails);

            var username      = HttpContext.Session["UserName"].ToString();
            var lastmodulerow = _iIModuleService.GetLastRow();

            if (username == "SuperAdmin")
            {
                usercredentialdetails.ModuleId     = lastmodulerow.Id;
                usercredentialdetails.Modules      = mainapp.GodownDetails.GodownName;
                usercredentialdetails.ModuleRights = "Add";
                usercredentialdetails.UseName      = username;
                usercredentialdetails.Email        = UserEmail;
                usercredentialdetails.Status       = "add";
                _IUserCredentialService.CreateUserCredential(usercredentialdetails);

                string query = "GetUsersEmail";
                var    list  = _godownService.GetUserEmails(query);
                foreach (var data in list)
                {
                    var userdetails = _IUserCredentialService.GetByEmail(data.Email);
                    usercredentialdetails.ModuleId         = lastmodulerow.Id;
                    usercredentialdetails.Modules          = mainapp.GodownDetails.GodownName;
                    usercredentialdetails.ModuleRights     = "Add";
                    usercredentialdetails.UseName          = userdetails.UseName;
                    usercredentialdetails.Email            = data.Email;
                    usercredentialdetails.Status           = "";
                    usercredentialdetails.AssignRightsCode = Godowncode;
                    _IUserCredentialService.CreateUserCredential(usercredentialdetails);
                }
            }
            else
            {
                //IF EXCEPT SUPERADMIN ADD GODOWN THEN IT WELL DISPLAY ALL EMPLOYEE IN USERCREDENTIAL
                string query = "GetUsersEmail";
                var    list  = _godownService.GetUserEmails(query);
                foreach (var data in list)
                {
                    var userdetails = _IUserCredentialService.GetByEmail(data.Email);
                    usercredentialdetails.ModuleId         = lastmodulerow.Id;
                    usercredentialdetails.Modules          = mainapp.GodownDetails.GodownName;
                    usercredentialdetails.ModuleRights     = "Add";
                    usercredentialdetails.UseName          = userdetails.UseName;
                    usercredentialdetails.Email            = data.Email;
                    usercredentialdetails.Status           = "";
                    usercredentialdetails.AssignRightsCode = Godowncode;
                    _IUserCredentialService.CreateUserCredential(usercredentialdetails);
                }
                usercredentialdetails.AssignRightsCode = null;
                usercredentialdetails.Status           = "add";
                usercredentialdetails.UseName          = "SuperAdmin";
                usercredentialdetails.Email            = "*****@*****.**";
                _IUserCredentialService.CreateUserCredential(usercredentialdetails);
            }
            var Id       = _godownService.getGodownLast().GodownId;
            var GodownId = Encode(Id.ToString());

            return(RedirectToAction("CreateDetails/" + GodownId, "Godown"));
        }