// // GET: /Branch/Edit/5 public ActionResult Edit(int id = 0) { //BranchFinnancialYearVm branchVM = new BranchFinnancialYearVm(); BranchMaster branchmaster = db.BranchMasters.Find(id); if (branchmaster == null) { return(HttpNotFound()); } var financialyear = db.AcFinancialYears.Where(d => d.BranchID == id).FirstOrDefault(); if (financialyear == null) { ViewBag.Fromdate = ""; ViewBag.Todate = ""; } else { ViewBag.Fromdate = financialyear.AcFYearFrom.Value.ToString("dd/MM/yyyy"); ViewBag.Todate = financialyear.AcFYearTo.Value.ToString("dd/MM/yyyy"); } ViewBag.Company = db.AcCompanies.ToList(); ViewBag.CountryID = db.CountryMasters.ToList(); ViewBag.CurrencyID = db.CurrencyMasters.ToList(); ViewBag.DesignationID = new SelectList(db.Designations, "DesignationID", "Designation1", branchmaster.DesignationID); ViewBag.LocationID = new SelectList(db.Locations, "LocationID", "Location1", branchmaster.LocationID); return(View(branchmaster)); }
public async Task <IHttpActionResult> PutBranchMaster(int id, BranchMaster branchMaster) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != branchMaster.Id) { return(BadRequest()); } db.Entry(branchMaster).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BranchMasterExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task AddBranchMaster(BranchMaster prodData) { var maxId = await WithConnection(async c => { return(await c.QueryAsync <int>("SELECT max(Branch_ID) FROM BranchMaster")); }); //Setting Primary Key if (maxId.SingleOrDefault() == 0) { prodData.Branch_ID = 1; } else { prodData.Branch_ID = maxId.SingleOrDefault() + 1; } //Filling Other Records like User Id, Creation & Update Date prodData.CreateUserIndex = 1; //Later Logged in User prodData.UpdateUserIndex = 1; //Later Logged in User prodData.CreateDateTime = DateTime.Now; prodData.UpdateDateTime = DateTime.Now; await WithConnection(async c => { return(await c.QueryAsync <int>(SQLConstants.InsertBranchMaster, prodData)); }); }
public ActionResult DeleteConfirmed(long id) { BranchMaster branchMaster = db.BranchMaster.Find(id); db.BranchMaster.Remove(branchMaster); db.SaveChanges(); return(RedirectToAction("Index")); }
protected void btnsave_Click(object sender, EventArgs e) { try { BranchMaster _objbranch = new BranchMaster(); _objbranch.BranchID = Convert.ToInt32(lblBranchId.Text); _objbranch.BranchCode = txtbranchCode.Text.Trim(); _objbranch.BranchName = txtbranchName.Text.Trim(); _objbranch.BranchAddress = txtbranchAddress.Text.Trim(); //_obranchnk.Country = txtcountry.Text.Trim(); _objbranch.State = Convert.ToInt32(DDLstate.SelectedValue); _objbranch.City = Convert.ToInt32(DDLCity.SelectedValue); _objbranch.IsActive = chekactive.Checked; _objbranch.IsDelete = false; _objbranch.CreatedBy = "Admin"; _objbranch.Remark1 = ""; _objbranch.Remark2 = ""; _objbranch.Remark3 = ""; //Response.Write(_objbranch.BranchCode + "\n" + _objbranch.BranchName + "\n" + _objbranch.BranchAddress + "\n" + _objbranch.State + "\n" + _objbranch.City + "\n" + _objbranch.IsActive + "\n" + _objbranch.IsDelete + "\n"); _objbranch.Save(); MessageBox("Record saved successfully"); BindGvBranchDetails(); if (btnsave.Text.ToString() == "Update") { Panel1.Visible = false; pnlBranch.Visible = true; filter.Visible = true; btnsave.Visible = false; } else { Panel1.Visible = true; pnlBranch.Visible = false; filter.Visible = false; btnsave.Visible = true; } lblBranchId.Text = ""; txtbranchCode.Text = ""; txtbranchName.Text = ""; //txtcountry.Text = ""; txtbranchAddress.Text = ""; chekactive.Checked = false; DDLCity.SelectedValue = null; DDLstate.SelectedValue = null; //UpdatePanel1.Update(); //UpdatePanel2.Update(); //UpdatePanel4.Update(); } catch { } }
public ActionResult Create(BranchMaster branchmaster, BranchFinnancialYearVm branchVM) { if (ModelState.IsValid) { var query = (from t in db.BranchMasters where t.BranchName == branchmaster.BranchName select t).ToList(); if (query.Count > 0) { ViewBag.SuccessMsg = "Branch name is already exist"; return(View()); } branchmaster.BranchID = objectSourceMaster.GetMaxNumberBranch(); branchmaster.BranchName = branchVM.BranchName; branchmaster.Address1 = branchVM.Address; branchmaster.AcCompanyID = branchVM.CompanyId; branchmaster.CurrencyID = branchVM.currencyId; branchmaster.CountryID = branchVM.CountryID; branchmaster.EMail = branchVM.Email; branchmaster.Website = branchVM.Website; branchmaster.City = branchVM.City; branchmaster.ContactPerson = branchVM.ContactPerson; branchmaster.Phone = branchVM.phone; db.BranchMasters.Add(branchmaster); db.SaveChanges(); AcFinancialYear acFinnancialYear = new AcFinancialYear(); acFinnancialYear.AcCompanyID = branchVM.CompanyId; acFinnancialYear.BranchID = branchmaster.BranchID; acFinnancialYear.AcFYearFrom = branchVM.FromDate; acFinnancialYear.AcFYearTo = branchVM.ToDate; var getfinancialyr = ""; if (branchVM.FromDate.Year == branchVM.ToDate.Year) { getfinancialyr = branchVM.FromDate.Year.ToString(); } else { getfinancialyr = branchVM.FromDate.Year + "-" + branchVM.ToDate.Year; } acFinnancialYear.ReferenceName = getfinancialyr; acFinnancialYear.StatusClose = false; acFinnancialYear.Lock = false; acFinnancialYear.AcFinancialYearID = objectSourceMaster.GetMaxNumberAcFinancialYear(); acFinnancialYear.UserID = Convert.ToInt32(Session["UserID"]); db.AcFinancialYears.Add(acFinnancialYear); TempData["SuccessMsg"] = "You have successfully added Branch."; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Company = new SelectList(db.AcCompanies, "AcCompanyID", "AcCompany1", branchmaster.AcCompanyID); ViewBag.CountryID = new SelectList(db.CountryMasters, "CountryID", "CountryName", branchmaster.CountryID); ViewBag.CurrencyID = new SelectList(db.CurrencyMasters, "CurrencyID", "CurrencyName", branchmaster.CurrencyID); ViewBag.DesignationID = new SelectList(db.Designations, "DesignationID", "Designation1", branchmaster.DesignationID); ViewBag.LocationID = new SelectList(db.Locations, "LocationID", "Location1", branchmaster.LocationID); return(View(branchmaster)); }
// // POST: /Branch/Delete/5 public ActionResult DeleteConfirmed(int id) { BranchMaster branchmaster = db.BranchMasters.Find(id); db.BranchMasters.Remove(branchmaster); db.SaveChanges(); TempData["SuccessMsg"] = "You have successfully deleted Branch."; return(RedirectToAction("Index")); }
public async Task <IHttpActionResult> Edit(BranchMaster prodData) { if (prodData != null) { await BranchDA.EditBranchMaster(prodData); return(Ok("ok")); } return(BadRequest("Request cannot be NULL")); }
// // GET: /Branch/Details/5 public ActionResult Details(int id = 0) { BranchMaster branchmaster = db.BranchMasters.Find(id); if (branchmaster == null) { return(HttpNotFound()); } return(View(branchmaster)); }
public async Task <IHttpActionResult> Delete(BranchMaster prodData) { if (prodData != null) { await BranchDA.DeleteBranchMaster(prodData); return(Ok("Index")); } return(BadRequest("Request cannot be NULL")); }
public async Task <IHttpActionResult> GetBranchMaster(int id) { BranchMaster branchMaster = await db.Branches.FindAsync(id); if (branchMaster == null) { return(NotFound()); } return(Ok(branchMaster)); }
public async Task <IHttpActionResult> PostBranchMaster(BranchMaster branchMaster) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Branches.Add(branchMaster); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = branchMaster.Id }, branchMaster)); }
public bool Insert_Update_BranchMaster(BranchMaster InputData) { try { MasterBL bl = new MasterBL(); return(bl.Insert_Update_BranchMaster(InputData)); } catch (Exception) { throw; } }
public async Task DeleteBranchMaster(BranchMaster prodData) { //Filling Other Records like User Id, Creation & Update Date prodData.UpdateUserIndex = 1; //Later Logged in User prodData.UpdateDateTime = DateTime.Now; await WithConnection(async c => { return(await c.QueryAsync <int>(SQLConstants.DeleteBranchMaster, prodData)); }); }
// GET: BranchMaster/Details/5 public ActionResult Details(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BranchMaster branchMaster = db.BranchMaster.Find(id); if (branchMaster == null) { return(HttpNotFound()); } return(View(branchMaster)); }
public async Task <IHttpActionResult> DeleteBranchMaster(int id) { BranchMaster branchMaster = await db.Branches.FindAsync(id); if (branchMaster == null) { return(NotFound()); } db.Branches.Remove(branchMaster); await db.SaveChangesAsync(); return(Ok(branchMaster)); }
// GET: BranchMaster/Edit/5 public ActionResult Edit(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BranchMaster branchMaster = db.BranchMaster.Find(id); if (branchMaster == null) { return(HttpNotFound()); } ViewBag.BankCode = new SelectList(db.BankMaster, "BankCode", "BankName", branchMaster.BankCode); return(View(branchMaster)); }
public bool Delete(long id) { BranchMaster branchMaster = db.BranchMaster.Find(id); if (branchMaster != null) { db.BranchMaster.Remove(branchMaster); db.SaveChanges(); return(true); } else { return(false); } }
public async Task <IActionResult> UpdateBranchMaster([FromBody] BranchMaster BranchMaster) { try { BranchMaster.ModifiedBy = "Admin"; BranchMaster.ModifiedDate = DateTime.Now; db.Entry(BranchMaster).State = Microsoft.EntityFrameworkCore.EntityState.Modified; db.SaveChanges(); return(Ok(BranchMaster)); } catch (Exception ex) { return(BadRequest()); } }
public ActionResult Edit(BranchMaster branchmaster) { if (ModelState.IsValid) { db.Entry(branchmaster).State = EntityState.Modified; db.SaveChanges(); TempData["SuccessMsg"] = "You have successfully updated Branch."; return(RedirectToAction("Index")); } ViewBag.Company = new SelectList(db.AcCompanies, "AcCompanyID", "AcCompany1"); ViewBag.CountryID = new SelectList(db.CountryMasters, "CountryID", "CountryName", branchmaster.CountryID); ViewBag.CurrencyID = new SelectList(db.CurrencyMasters, "CurrencyID", "CurrencyName", branchmaster.CurrencyID); ViewBag.DesignationID = new SelectList(db.Designations, "DesignationID", "Designation1", branchmaster.DesignationID); ViewBag.LocationID = new SelectList(db.Locations, "LocationID", "Location1", branchmaster.LocationID); return(View(branchmaster)); }
public ChitTest(ContextFactory contextFactory) { RandomGenerator randomGenerator = new RandomGenerator(); this.contextFactory = contextFactory; var context = contextFactory.GetContext(); license = Builder <LicenseMaster> .CreateNew() .Build(); branch = Builder <BranchMaster> .CreateNew() .With(b => b.LicenseMasterId = license.Id) .Build(); context.BranchMasters.Add(branch); context.SaveChanges(); }
public async Task <IActionResult> CreateBranch([FromBody] BranchMaster BranchMaster) { try { //BranchMaster.EnquiryID = 0; BranchMaster.CreatedBy = "Admin"; BranchMaster.CreatedDate = DateTime.Now; BranchMaster.ModifiedBy = "Admin"; BranchMaster.ModifiedDate = DateTime.Now; BranchMaster.Active = true; db.branchMasters.Add(BranchMaster); db.SaveChanges(); return(Ok(BranchMaster)); } catch (Exception ex) { return(BadRequest()); } }
protected void grdBranchDetails_RowDeleting(object sender, GridViewDeleteEventArgs e) { BranchMaster _objBranch = new BranchMaster(); _objBranch.BranchID = Convert.ToInt32(((Label)grdBranchDetails.Rows[e.RowIndex].FindControl("lblBranchID")).Text); _objBranch.BranchName = (((Label)grdBranchDetails.Rows[e.RowIndex].FindControl("lblBranchName")).Text); _objBranch.BranchAddress = (((Label)grdBranchDetails.Rows[e.RowIndex].FindControl("lblBranchAddress")).Text); _objBranch.IsActive = Convert.ToBoolean(false); _objBranch.IsDelete = Convert.ToBoolean(true); try { _objBranch.Save(); BindGvBranchDetails(); Panel1.Visible = false; pnlBranch.Visible = true; } catch { } }
public ActionResult Edit([Bind(Include = "BranchCode,BankCode,BranchName,MICR_Code,IFSC_Code,Contact,Fax,EmailID,Country,State,City,Address,PinCode")] BranchMaster branchMaster) { if (ModelState.IsValid) { bool isValid = db.BranchMaster.Any(x => (x.BranchCode != branchMaster.BranchCode) && (x.BankCode == branchMaster.BankCode && x.BranchName == branchMaster.BranchName)); if (!isValid) { db.Entry(branchMaster).State = EntityState.Modified; db.SaveChanges(); ViewBag.success = "Your Record Successfully Updated!"; long cid = db.Country.Where(x => x.CountryName == branchMaster.Country).Select(x => x.CountryID).SingleOrDefault(); long sid = db.State.Where(x => x.StateName == branchMaster.State).Select(x => x.StateID).SingleOrDefault(); ViewBag.BankCode = new SelectList(db.BankMaster, "BankCode", "BankName", branchMaster.BankCode); ViewBag.Country = new SelectList(db.Country, "CountryName", "CountryName"); ViewBag.State = new SelectList(db.State.Where(x => x.CountryID == cid), "StateName", "StateName"); ViewBag.City = new SelectList(db.City.Where(x => x.StateID == sid), "CityName", "CityName"); return(View()); } else { ViewBag.error = "Branch Name is Already exist!"; long cid = db.Country.Where(x => x.CountryName == branchMaster.Country).Select(x => x.CountryID).SingleOrDefault(); long sid = db.State.Where(x => x.StateName == branchMaster.State).Select(x => x.StateID).SingleOrDefault(); ViewBag.BankCode = new SelectList(db.BankMaster, "BankCode", "BankName", branchMaster.BankCode); ViewBag.Country = new SelectList(db.Country, "CountryName", "CountryName"); ViewBag.State = new SelectList(db.State.Where(x => x.CountryID == cid), "StateName", "StateName"); ViewBag.City = new SelectList(db.City.Where(x => x.StateID == sid), "CityName", "CityName"); return(View()); } } long cid1 = db.Country.Where(x => x.CountryName == branchMaster.Country).Select(x => x.CountryID).SingleOrDefault(); long sid1 = db.State.Where(x => x.StateName == branchMaster.State).Select(x => x.StateID).SingleOrDefault(); ViewBag.BankCode = new SelectList(db.BankMaster, "BankCode", "BankName", branchMaster.BankCode); ViewBag.Country = new SelectList(db.Country, "CountryName", "CountryName"); ViewBag.State = new SelectList(db.State.Where(x => x.CountryID == cid1), "StateName", "StateName"); ViewBag.City = new SelectList(db.City.Where(x => x.StateID == sid1), "CityName", "CityName"); return(View(branchMaster)); }
public bool SaveBranch(BranchModel model) { try { BranchMaster master = new BranchMaster { IsActive = true, maxAdvance = model.maxAdvance, mobileNo = model.mobileNo, mr = model.mr, pincode = model.pincode, stateId = model.stateId, areaId = model.areaId, branchCode = model.branchCode, branchName = model.branchName, branchType = model.branchType, challan = model.challan, cityId = model.cityId, cn = model.cn, defaultBankLedger = model.defaultBankLedger, defaultCashLedger = model.defaultCashLedger, deliveryAgainstAs = model.deliveryAgainstAs, expectedUnderLoad = model.expectedUnderLoad, expectedUnloadingAfterArrival = model.expectedUnloadingAfterArrival, freightBill = model.freightBill, gstNo = model.gstNo, phoneNo = model.phoneNo, regionId = model.regionId, remark = model.remark, servicesOffered = model.servicesOffered }; _tRSEntities.BranchMasters.Add(master); _tRSEntities.SaveChanges(); return(true); } catch (Exception e) { throw e; } }
public ActionResult Create([Bind(Include = "BranchCode,BankCode,BranchName,MICR_Code,IFSC_Code,Contact,Fax,EmailID,Country,State,City,Address,PinCode")] BranchMaster branchMaster) { if (ModelState.IsValid) { bool isValid = db.BranchMaster.Any(x => (x.BankCode == branchMaster.BankCode) && (x.BranchName == branchMaster.BranchName)); if (!isValid) { db.BranchMaster.Add(branchMaster); db.SaveChanges(); ViewBag.success1 = "Branch is Successfully created!"; ModelState.Clear(); ViewBag.BankCode = new SelectList(db.BankMaster, "BankCode", "BankName"); ViewBag.Country = new SelectList(db.Country, "CountryName", "CountryName"); ViewBag.State = new SelectList(""); ViewBag.City = new SelectList(""); return(View()); } else { ViewBag.error1 = "Sorry! Branch Name is already exist!"; long cid = db.Country.Where(x => x.CountryName == branchMaster.Country).Select(x => x.CountryID).SingleOrDefault(); long sid = db.State.Where(x => x.StateName == branchMaster.State).Select(x => x.StateID).SingleOrDefault(); ViewBag.BankCode = new SelectList(db.BankMaster, "BankCode", "BankName"); ViewBag.Country = new SelectList(db.Country, "CountryName", "CountryName"); ViewBag.State = new SelectList(db.State.Where(x => x.CountryID == cid), "StateName", "StateName"); ViewBag.City = new SelectList(db.City.Where(x => x.StateID == sid), "CityName", "CityName"); return(View(branchMaster)); } } ViewBag.BankCode = new SelectList(db.BankMaster, "BankCode", "BankName", branchMaster.BankCode); ViewBag.Country = new SelectList(db.Country, "CountryName", "CountryName"); ViewBag.State = new SelectList(""); ViewBag.City = new SelectList(""); return(View(branchMaster)); }
public async Task DeleteAsync(BranchMaster entity) { await _branchMasterRepo.RemoveAsync(entity); }
protected void Page_UnLoad(object sender, EventArgs e) { objCommonClass = null; objBranchMaster = null; }
public async Task InsertAsync(BranchMaster entity) { await _branchMasterRepo.AddAsync(entity); }
public async Task UpdateAsync(BranchMaster entity) { await _branchMasterRepo.UpdateAsync(entity); }