protected async void Group_Change(string value) { int val; Int32.TryParse(L_ID, out int LID); BSheetGID = value; //******************Data Fetching through lambda-expression //AcMastersNew = (IEnumerable<AcMaster>) await AcMasterService.GetMaxAccountNo(AccountGroupChange.Value.ToString()); //******************Data Fetching through store-procedure AcMastersNew = await AcMasterService.GetMaxAcNo_sp(value); if (AcMastersNew.Count() > 0) { foreach (var acm in AcMastersNew) { Int32.TryParse(acm.Acno, out val); Maxaccountno = (val + 1).ToString(); AcMasters = new AcMaster { LedgerID = LID, LedgerCode = L_Code, Acno = Maxaccountno, DrCr = "D", CountryID = 1, StateID = 1, Ason = DateTime.Now, AuthorisedDate = DateTime.Now, Compcode = "001", Dob = DateTime.Now, CreatedDate = DateTime.Now, CreatedBy = CreatedUser }; StateHasChanged(); } } else { Int32.TryParse(value, out val); Maxaccountno = (val + 1).ToString(); //Int32.TryParse(L_ID, out LID); AcMasters = new AcMaster { LedgerID = LID, LedgerCode = L_Code, Acno = Maxaccountno, DrCr = "D", CountryID = 1, StateID = 1, Ason = DateTime.Now, AuthorisedDate = DateTime.Now, Compcode = "001", Dob = DateTime.Now, CreatedDate = DateTime.Now, CreatedBy = CreatedUser }; StateHasChanged(); } }
async Task <AcMaster> IAcMasterRepository.AddAcMaster(AcMaster acMaster) { var result = await appDbContext.AcMasters.AddAsync(acMaster); await appDbContext.SaveChangesAsync(); return(result.Entity); }
async Task <AcMaster> IAcMasterRepository.UpdateAcMaster(AcMaster acMaster) { var result = await appDbContext.AcMasters .FirstOrDefaultAsync(a => a.AcMasterID == acMaster.AcMasterID); if (result != null) { result.LedgerCode = acMaster.LedgerCode; result.Acno = acMaster.Acno; result.Acname = acMaster.Acname; result.Compcode = acMaster.Compcode; result.Opbal = acMaster.Opbal; result.Ason = acMaster.Ason; result.DrCr = acMaster.DrCr; result.Acad1 = acMaster.Acad1; result.Acad2 = acMaster.Acad2; result.Acad3 = acMaster.Acad3; result.Acad4 = acMaster.Acad4; result.City = acMaster.City; result.Pin = acMaster.Pin; result.TypeMastID = acMaster.TypeMastID; result.BSheetGroupID = acMaster.BSheetGroupID; result.Descr = acMaster.Descr; result.Panno = acMaster.Panno; result.Tanno = acMaster.Tanno; result.STaxno = acMaster.STaxno; result.Tin_VatNo = acMaster.Tin_VatNo; result.Phone = acMaster.Phone; result.Mobile1 = acMaster.Mobile1; result.Mobile2 = acMaster.Mobile2; result.FaxNo = acMaster.FaxNo; result.EMail = acMaster.EMail; result.ContactPerson = acMaster.ContactPerson; result.GroupSeries = acMaster.GroupSeries; result.LimitAmount = acMaster.LimitAmount; result.CreditAmount = acMaster.CreditAmount; result.Dob = acMaster.Dob; result.StateID = acMaster.StateID; result.CountryID = acMaster.CountryID; result.CreatedBy = acMaster.CreatedBy; result.CreatedDate = acMaster.CreatedDate; result.AuthorisedBy = acMaster.AuthorisedBy; result.AuthorisedAc = acMaster.AuthorisedAc; result.AuthorisedDate = acMaster.AuthorisedDate; result.CostCenterID = acMaster.CostCenterID; result.CorporateName = acMaster.CorporateName; result.GSTCode = acMaster.GSTCode; result.ServiceCode = acMaster.ServiceCode; result.AdharNo = acMaster.AdharNo; await appDbContext.SaveChangesAsync(); return(result); } return(null); }
protected async override Task OnInitializedAsync() { Ledgers = (await LedgerService.GetLedgers()).ToList(); AccountGroupMasters = (await AccountGroupMasterService.GetAccountGroupMasters()).ToList(); //AcMasters = (AcMaster)await AcMasterService.GetAcMasters(); AcMasters = new AcMaster { Acno = Maxaccountno, Ason = DateTime.Now, CreatedBy = CreatedUser, CreatedDate = DateTime.Now, AuthorisedAc = false, AuthorisedDate = DateTime.Now, AuthorisedBy = "pdp" }; }
public async Task <ActionResult <AcMaster> > AddAcMaster(AcMaster acMaster) { try { if (acMaster == null) { return(BadRequest()); } var CreatedAccount = await acMasterRepository.AddAcMaster(acMaster); return(CreatedAtAction(nameof(GetAcMaster), new { id = CreatedAccount.AcMasterID }, CreatedAccount)); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, "Error retrieving data from database")); } }
protected async override Task OnInitializedAsync() { Ledgers = (await LedgerService.GetLedgers()).ToList(); AcMaster = await AcMasterService.GetAcMaster(int.Parse(Id)); AcMaster = new AcMaster { AcMasterID = AcMaster.AcMasterID, LedgerID = AcMaster.LedgerID, LedgerCode = AcMaster.LedgerCode, Acno = AcMaster.Acno, Acname = AcMaster.Acname, CreatedBy = AcMaster.CreatedBy, CreatedDate = AcMaster.CreatedDate, AuthorisedBy = AcMaster.AuthorisedBy == null ? "LoginUser" : AcMaster.AuthorisedBy, AuthorisedAc = AcMaster.AuthorisedAc == false ? false : AcMaster.AuthorisedAc, AuthorisedDate = AcMaster.AuthorisedDate == null ? DateTime.Now :AcMaster.AuthorisedDate }; }
public async Task <ActionResult <AcMaster> > UpdateAcMaster(AcMaster acMaster) { try { //if (id != acMaster.AcMasterID) //{ // return BadRequest("Account ID mismatch"); //} var accountToUpdate = await acMasterRepository.GetAcMaster(acMaster.AcMasterID); if (accountToUpdate == null) { return(NotFound($"Account Id={acMaster.AcMasterID} not found")); } return(await acMasterRepository.UpdateAcMaster(acMaster)); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, "Error updating data")); } }
protected void LedgerChange(string value) { string[] get_value = value.Split(","); L_ID = get_value[0].ToString(); Int32.TryParse(L_ID, out int LID); L_Code = get_value[1].ToString(); LedgerID = value; BSheetGID = "0"; AcMasters = new AcMaster { LedgerID = LID, LedgerCode = L_Code, Acno = "", DrCr = "D", CountryID = 1, StateID = 1, Ason = DateTime.Now, AuthorisedDate = DateTime.Now, Compcode = "001", Dob = DateTime.Now, CreatedDate = DateTime.Now, CreatedBy = CreatedUser }; }
public async Task <AcMaster> UpdateAcMaster(AcMaster updatedAcmaster) { return(await httpClient.PutJsonAsync <AcMaster>("api/AcMasters", updatedAcmaster)); }
public async Task <AcMaster> AddAcMaster(AcMaster NewAccountMaster) { return(await httpClient.PostJsonAsync <AcMaster>("api/AcMasters", NewAccountMaster)); }