public async Task <IActionResult> AddorEdit([Bind("binId,BinName,WarehouseId,Code,Remarks,IsAc,Status,CompanyID,CreatedOn,CreatedBy,ModifiedBy,ModifiedOn,IP")] binarea binarea) { if (ModelState.IsValid) { if (binarea.binId == 0) { binarea.Status = AppConstant.Active; binarea.CreatedOn = System.DateTime.Now; binarea.ModifiedOn = System.DateTime.Now; binarea.IP = GETIP.GetIp(); binarea.CompanyID = AppConstant.CompanyID; context.Add(binarea); } else { binarea.Status = AppConstant.Active; binarea.ModifiedOn = System.DateTime.Now; binarea.IP = GETIP.GetIp(); binarea.CompanyID = AppConstant.CompanyID; context.Update(binarea); } await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["WarehouseId"] = new SelectList(context.Warehouse, "WarehouseId", "Name", binarea.WarehouseId); return(View(binarea)); }
public async Task <IActionResult> AddorEdit([Bind("PimCatID,Name,Code,Description,CompanyID,CreatedOn,CreatedBy,ModifiedBy,ModifiedOn,IP,VatStatus,VatType")] pimcategory pimcategory) { if (ModelState.IsValid) { if (pimcategory.PimCatID == 0) { // pimcategory.Status = AppConstant.Active; pimcategory.CreatedOn = System.DateTime.Now; pimcategory.ModifiedOn = System.DateTime.Now; pimcategory.IP = GETIP.GetIp(); pimcategory.CompanyID = AppConstant.CompanyID; context.Add(pimcategory); ViewData["msg"] = "Data Added successfully"; } else { // pimcategory.Status = AppConstant.Active; pimcategory.ModifiedOn = System.DateTime.Now; pimcategory.IP = GETIP.GetIp(); pimcategory.CompanyID = AppConstant.CompanyID; context.Update(pimcategory); } await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(pimcategory)); }
public async Task <IActionResult> AddorEdit([Bind("UomId,Name,Code,Description,Status,CompanyID,CreatedOn,CreatedBy,ModifiedBy,ModifiedOn,IP")] Uom uom) { if (ModelState.IsValid) { if (uom.UomId == 0) { uom.Status = AppConstant.Active; // department.CreatedBy = userId; uom.CreatedOn = System.DateTime.Now; uom.ModifiedOn = System.DateTime.Now; uom.IP = ipmodel.GetIp(); uom.CompanyID = AppConstant.CompanyID; context.Add(uom); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } else { uom.Status = AppConstant.Active; uom.ModifiedOn = System.DateTime.Now; uom.IP = ipmodel.GetIp(); uom.CompanyID = AppConstant.CompanyID; context.Update(uom); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } } return(View(uom)); }
public async Task <IActionResult> AddorEdit([Bind("VehPermitId,VehPermitName,Code,Status,CompanyID,CreatedOn,CreatedBy,ModifiedBy,ModifiedOn,IP")] VehPermit vehPermit) { if (ModelState.IsValid) { if (vehPermit.VehPermitId == 0) { vehPermit.Status = AppConstant.Active; vehPermit.CreatedOn = System.DateTime.Now; vehPermit.ModifiedOn = System.DateTime.Now; vehPermit.IP = GETIP.GetIp(); vehPermit.CompanyID = AppConstant.CompanyID; context.Add(vehPermit); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } else { vehPermit.Status = AppConstant.Active; vehPermit.ModifiedOn = System.DateTime.Now; vehPermit.IP = GETIP.GetIp(); vehPermit.CompanyID = AppConstant.CompanyID; context.Update(vehPermit); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } } return(View(vehPermit)); }
public async Task <IActionResult> AddorEdit([Bind("WarehouseId,Name,Code,BranchId,MangerID,Address,Address2,PostCode,StateId,CountryId,CityId,ContactPer,ContPerMobNo,ContPerEmail,WMFaxNo,WMDepartmentId,WMTeleNo,WMEmail,WMUrl,WMCurrencyId,Status,CompanyID,CreatedOn,CreatedBy,ModifiedBy,ModifiedOn,IP")] Warehouse warehouse) { if (ModelState.IsValid) { if (warehouse.WarehouseId == 0) { warehouse.Status = AppConstant.Active; warehouse.CreatedOn = System.DateTime.Now; warehouse.ModifiedOn = System.DateTime.Now; warehouse.IP = GETIP.GetIp(); warehouse.CompanyID = AppConstant.CompanyID; context.Add(warehouse); } else { warehouse.Status = AppConstant.Active; warehouse.CreatedOn = System.DateTime.Now; warehouse.ModifiedOn = System.DateTime.Now; warehouse.IP = GETIP.GetIp(); warehouse.CompanyID = AppConstant.CompanyID; context.Update(warehouse); } await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["StateId"] = new SelectList(context.state, "StateId", "StateName"); ViewData["CountryId"] = new SelectList(context.country, "CountryId", "CountryName"); ViewData["CityId"] = new SelectList(context.city, "CityId", "CityName"); ViewData["DepartmentId"] = new SelectList(context.department, "DeptId", "Name"); ViewData["CurrencyId"] = new SelectList(context.currency, "CurrencyId", "Name"); return(View(warehouse)); }
public async Task <IActionResult> AddorEdit([Bind("DeptId,Name,Code,Description,Status,CompanyID,CreatedOn,CreatedBy,ModifiedBy,ModifiedOn,IP")] Department department) { if (ModelState.IsValid) { if (department.DeptId == 0) { department.Status = AppConstant.Active; // department.CreatedBy = userId; department.CreatedOn = System.DateTime.Now; department.ModifiedOn = System.DateTime.Now; //department.IP = GETIP.GetIPAddress(); department.IP = GETIP.GetIp(); department.CompanyID = AppConstant.CompanyID; context.Add(department); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } else { department.Status = AppConstant.Active; department.ModifiedOn = System.DateTime.Now; department.IP = GETIP.GetIp(); department.CompanyID = AppConstant.CompanyID; context.Update(department); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } } return(View(department)); }
public async Task <IActionResult> Create(SupplierViewModel sm) { var supplier = new Supplier { SupName = sm.SupName, SupCode = sm.SupCode, SupTrnNo = sm.SupTrnNo, SupLoginEnable = sm.SupLoginEnable, Status = AppConstant.Active, CompanyID = AppConstant.CompanyID, CreatedOn = System.DateTime.Now, ModifiedOn = System.DateTime.Now, IP = Ipadd.GetIp() }; var addrs = new Address { TypeId = AppConstant.Supplier, TypeRefId = sm.SupID, AddressAprtNo = sm.AddressAprtNo, AddressFloorNo = sm.AddressFloorNo, AddressBuildingNo = sm.AddressBuildingNo, AddressBuildingName = sm.AddressBuildingName, AddressStreetName = sm.AddressStreetName, AddressStreetNo = sm.AddressStreetNo, AddressAreaCode = sm.AddressAreaCode, AddressAreaName = sm.AddressAreaName, AddressCity = sm.AddressCity, AddressDistrict = sm.AddressDistrict, AddressState = sm.AddressState, AddressCountry = sm.AddressCountry, AddressContactNo1 = sm.AddressContactNo1, AddressContactNo2 = sm.AddressContactNo2, AddressEmailId1 = sm.AddressEmailId1, AddressEmailId2 = sm.AddressEmailId2, AddressContactPerson1 = sm.AddressContactPerson1, AddressContactPerson2 = sm.AddressContactPerson2, AddressLatLoc = sm.AddressLatLoc, AddressLongLoc = sm.AddressLongLoc, AddressUrl = sm.AddressUrl, AddressClosestLandMark = sm.AddressClosestLandMark, AddressField1 = sm.AddressField1, AddressField2 = sm.AddressField2, AddressField3 = sm.AddressField3, AddressField4 = sm.AddressField4, AddressField5 = sm.AddressField5, Status = AppConstant.Active, CompanyID = AppConstant.CompanyID, CreatedOn = System.DateTime.Now, ModifiedOn = System.DateTime.Now, IP = Ipadd.GetIp() }; context.Supplier.Add(supplier); context.Address.Add(addrs); await context.SaveChangesAsync(); ViewData["SupId"] = new SelectList(context.Supplier, "SupID", "SupName"); return(View()); }
public async Task <IActionResult> AddorEdit([Bind("CurrencyId,Name,Code,Description,Status,CompanyID,CreatedOn,CreatedBy,ModifiedBy,ModifiedOn,IP")] Currency currency) { if (ModelState.IsValid) { if (currency.CurrencyId == 0) { currency.Status = AppConstant.Active; currency.CreatedOn = System.DateTime.Now; currency.ModifiedOn = System.DateTime.Now; currency.IP = Ipadd.GetIp(); currency.CompanyID = AppConstant.CompanyID; context.Add(currency); } else { currency.Status = AppConstant.Active; currency.ModifiedOn = System.DateTime.Now; currency.IP = Ipadd.GetIp(); currency.CompanyID = AppConstant.CompanyID; // context.Entry(currency).State = EntityState.Modified; context.Update(currency); } await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(currency)); }
public async Task <IActionResult> AddorEdit([Bind("PimCatTypeID,Name,Code,Description,CompanyID,CreatedOn,CreatedBy,ModifiedOn,ModifiedBy,Status,IP,VatStatus,VatType,PimCatID")] pimcategorytype pimcategorytype) { if (ModelState.IsValid) { if (pimcategorytype.PimCatTypeID == 0) { pimcategorytype.Status = AppConstant.Active; pimcategorytype.CreatedOn = System.DateTime.Now; pimcategorytype.ModifiedOn = System.DateTime.Now; pimcategorytype.IP = GETIP.GetIp(); pimcategorytype.CompanyID = AppConstant.CompanyID; context.Add(pimcategorytype); } else { pimcategorytype.Status = AppConstant.Active; pimcategorytype.ModifiedOn = System.DateTime.Now; pimcategorytype.IP = GETIP.GetIp(); pimcategorytype.CompanyID = AppConstant.CompanyID; context.Update(pimcategorytype); } await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PimCatID"] = new SelectList(context.pimcategory, "PimCatID", "Name", pimcategorytype.pimcategory); return(View(pimcategorytype)); }
public async Task <IActionResult> AddorEdit([Bind("HSCodeId,Name,Code,Description,Status,CompanyID,CreatedOn,CreatedBy,ModifiedBy,ModifiedOn,IP")] HSCode hSCode) { if (ModelState.IsValid) { if (hSCode.HSCodeId == 0) { hSCode.Status = AppConstant.Active; hSCode.CreatedOn = System.DateTime.Now; hSCode.ModifiedOn = System.DateTime.Now; hSCode.IP = Ipadd.GetIp(); hSCode.CompanyID = AppConstant.CompanyID; context.Add(hSCode); } else { hSCode.Status = AppConstant.Active; hSCode.ModifiedOn = System.DateTime.Now; hSCode.IP = Ipadd.GetIp(); hSCode.CompanyID = AppConstant.CompanyID; context.Update(hSCode); } await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(hSCode)); }
public async Task <IActionResult> AddorEdit([Bind("VehtypeId,Name,Code,Description,Status,CompanyID,CreatedOn,CreatedBy,ModifiedBy,ModifiedOn,IP")] Vehicletype vehicletype) { if (ModelState.IsValid) { if (vehicletype.VehtypeId == 0) { vehicletype.Status = AppConstant.Active; vehicletype.CreatedOn = System.DateTime.Now; vehicletype.ModifiedOn = System.DateTime.Now; vehicletype.IP = ipmodel.GetIp(); vehicletype.CompanyID = AppConstant.CompanyID; context.Add(vehicletype); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } else { vehicletype.Status = AppConstant.Active; //uom.CreatedOn = System.DateTime.Now; vehicletype.ModifiedOn = System.DateTime.Now; vehicletype.IP = ipmodel.GetIp(); vehicletype.CompanyID = AppConstant.CompanyID; context.Update(vehicletype); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } } return(View(vehicletype)); }
public async Task <IActionResult> AddorEdit([Bind("TaxId,TaxName,Code,Rate,Description,Status,CompanyID,CreatedOn,CreatedBy,ModifiedBy,ModifiedOn,IP")] taxmaster taxmaster) { if (ModelState.IsValid) { if (taxmaster.TaxId == 0) { taxmaster.Status = AppConstant.Active; taxmaster.CreatedOn = System.DateTime.Now; taxmaster.ModifiedOn = System.DateTime.Now; taxmaster.IP = GETIP.GetIp(); taxmaster.CompanyID = AppConstant.CompanyID; context.Add(taxmaster); } else { taxmaster.Status = AppConstant.Active; taxmaster.ModifiedOn = System.DateTime.Now; taxmaster.IP = GETIP.GetIp(); taxmaster.CompanyID = AppConstant.CompanyID; context.Update(taxmaster); } await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(taxmaster)); }
public async Task <IActionResult> AddorEdit([Bind("AddressId,AddressAprtNo,AddressFloorNo,AddressBuildingNo,AddressBuildingName,AddressStreetName,AddressStreetNo,AddressAreaCode,AddressAreaName,AddressCity,AddressDistrict,AddressState,AddressCountry,AddressContactNo1,AddressContactNo2,AddressEmailId1,AddressEmailId2,AddressContactPerson1,AddressContactPerson2,AddressLatLoc,AddressLongLoc,AddressUrl,AddressClosestLandMark,AddressField1,AddressField2,AddressField3,AddressField4,AddressField5,TypeId,TypeReferenceId")] Address address) { if (ModelState.IsValid) { if (address.AddressId == 0) { address.TypeId = AppConstant.Supplier; address.Status = AppConstant.Active; address.CreatedOn = System.DateTime.Now; address.ModifiedOn = System.DateTime.Now; address.IP = Ipadd.GetIp(); address.CompanyID = AppConstant.CompanyID; context.Add(address); } else { //address.TypeId = AppConstant.Supplier; address.Status = AppConstant.Active; address.ModifiedOn = System.DateTime.Now; address.IP = Ipadd.GetIp(); address.CompanyID = AppConstant.CompanyID; context.Update(address); } await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["SupId"] = new SelectList(context.Supplier, "SupID", "SupName"); return(View(address)); }
public async Task <IActionResult> AddorEdit([Bind("OUTypeID,Name,Code,Description,Status,CompanyID,CreatedOn,CreatedBy,ModifiedBy,ModifiedOn,IP")] OUType oUType) { if (ModelState.IsValid) { if (oUType.OUTypeID == 0) { oUType.Status = AppConstant.Active; oUType.CreatedOn = System.DateTime.Now; oUType.ModifiedOn = System.DateTime.Now; oUType.IP = GETIP.GetIp(); oUType.CompanyID = AppConstant.CompanyID; context.Add(oUType); } else { oUType.Status = AppConstant.Active; oUType.ModifiedOn = System.DateTime.Now; oUType.IP = GETIP.GetIp(); oUType.CompanyID = AppConstant.CompanyID; context.Update(oUType); } await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(oUType)); }
public async Task <IActionResult> AddorEdit([Bind("CmpId,CompanyID,CompName,CompCode,CompTrnNo,CompAddress,CompCity,CompState,CompCountry,CompZipCode,CompPrefPhoneNo,CompAltPhoneNo,CompContactName,CompRefNameNo,CompLoginEnable,CompAddress2,compLogo,OrgTypeID,OrgID,LicenseType,UserLimit,DefWorkStartTime,DefWorkEndTime,FinStartDate,FinEndDate,CmpTimeZone,CompBussinessHr,MaxWrkHr,TrnNo,CreatedOn,CreatedBy,ModifiedBy,ModifiedOn,IP,Status")] CompanyDet companyDet, IFormFile file) { if (ModelState.IsValid) { if (companyDet.CmpId == 0) { companyDet.Status = AppConstant.Active; companyDet.CreatedOn = System.DateTime.Now; companyDet.ModifiedOn = System.DateTime.Now; companyDet.IP = Ipadd.GetIp(); context.Add(companyDet); await context.SaveChangesAsync(); if (file != null || file.Length != 0) { FileInfo fi = new FileInfo(file.FileName); var newFilename = companyDet.CmpId + "_" + String.Format("{0:d}", (DateTime.Now.Ticks / 10) % 100000000) + fi.Extension; var webPath = hostingEnvironment.WebRootPath; var path = Path.Combine("", webPath + @"\ImageFiles\" + newFilename); var pathToSave = @"/images/" + newFilename; using (var stream = new FileStream(path, FileMode.Create)) { await file.CopyToAsync(stream); } companyDet.compLogo = pathToSave; context.Update(companyDet); await context.SaveChangesAsync(); } } else { companyDet.Status = AppConstant.Active; companyDet.CreatedOn = System.DateTime.Now; companyDet.ModifiedOn = System.DateTime.Now; companyDet.IP = Ipadd.GetIp(); context.Update(companyDet); await context.SaveChangesAsync(); } await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["City"] = new SelectList(context.city, "CityID", "Name"); ViewData["State"] = new SelectList(context.state, "StateID", "Name"); ViewData["Country"] = new SelectList(context.country, "CountryID", "Name"); return(View(companyDet)); }