public ActionResult Create(MainApplication model, FormCollection form) { var details = _CommissionService.GetLast(); int lastid = 0; int length = 0; if (details != null) { lastid = details.CommissionId; lastid = lastid + 1; length = lastid.ToString().Length; } else { lastid = 1; length = 1; } string commcode = _utilityService.getName("CMS", length, lastid); model.CommissionMasterDetails.CommissionCode = commcode; model.CommissionProductDetails = new CommissionProduct(); model.CommissionMasterDetails.ModifiedOn = DateTime.Now; model.CommissionMasterDetails.Status = "Active"; if (model.CommissionMasterDetails.ItemCode != null) { model.CommissionMasterDetails.ItemName = _ItemService.GetDescriptionByItemCode(model.CommissionMasterDetails.ItemCode).itemName; } _CommissionService.Create(model.CommissionMasterDetails); int count = Convert.ToInt32(form["rowcount"]); for (int i = 1; i <= count; i++) { var product = "product" + i; var productamount = "productamount" + i; var productpercent = "productpercent" + i; if (form[product] != null && form[product] != "") { model.CommissionProductDetails.CommissionCode = model.CommissionMasterDetails.CommissionCode; model.CommissionProductDetails.EmployeeName = model.CommissionMasterDetails.EmployeeName; model.CommissionProductDetails.UnitName = form[product]; model.CommissionProductDetails.UnitAmount = form[productamount]; model.CommissionProductDetails.UnitPercent = Convert.ToDouble(form[productpercent]); model.CommissionProductDetails.Status = "Active"; model.CommissionProductDetails.ModifiedOn = DateTime.Now; _CommissionProductService.Create(model.CommissionProductDetails); } } var detailss = _CommissionService.GetLast(); string Id = Encode(detailss.CommissionId.ToString()); return(RedirectToAction("CommissionDetails/" + Id, "Commission")); }
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")); }