コード例 #1
0
        public ActionResult Create(MainApplication mainApplication)
        {
            var ClientDetails = _ClientMasterService.GetLastInsertedClient();
            int lastid        = 0;
            int length        = 0;

            if (ClientDetails != null)
            {
                lastid = ClientDetails.ClientId;
                lastid = lastid + 1;
                length = lastid.ToString().Length;
            }
            else
            {
                lastid = 1;
                length = 1;
            }
            string catCode = _UtilityService.getName("CL", length, lastid);


            string LogedinUSerName = HttpContext.Session["UserName"].ToString();

            if (TempData["ClientBankList" + LogedinUSerName] != null)
            {
                var list = TempData["ClientBankList" + LogedinUSerName] as IEnumerable <ClientBankDetail>;
                foreach (var bank in list)
                {
                    bank.ClientCode = catCode;
                    bank.Status     = "Active";
                    bank.ModifiedOn = DateTime.Now;
                    _ClientBankDetailService.CreateBankDetails(bank);
                }
            }

            if (mainApplication.ClientBankDetails.BankName != null)
            {
                mainApplication.ClientBankDetails.ClientCode = mainApplication.clientcode;
                mainApplication.ClientBankDetails.Status     = "Active";
                mainApplication.ClientBankDetails.ModifiedOn = DateTime.Now;
                _ClientBankDetailService.CreateBankDetails(mainApplication.ClientBankDetails);
            }
            int did = Convert.ToInt32(mainApplication.ClientDetails.District);

            mainApplication.ClientDetails.District = _DistrictService.GetDistrictNamebyId(did);
            string Clientname = mainApplication.ClientDetails.ClientName;

            mainApplication.ClientDetails.ClientName = Clientname.First().ToString().ToUpper() + Clientname.Substring(1);
            mainApplication.ClientDetails.Status     = "Active";
            mainApplication.ClientDetails.ModifiedOn = DateTime.Now;
            mainApplication.ClientDetails.ClientCode = catCode;
            _ClientMasterService.CreateClient(mainApplication.ClientDetails);
            var    Details  = _ClientMasterService.GetLastInsertedClient();
            string clientid = Encode(Details.ClientId.ToString());

            return(RedirectToAction("Details/" + clientid, "Client"));
        }
コード例 #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"));
        }