public PartialViewResult GetByVendorId(string VendorId) { VendorModel VM = new VendorModel(); VM = VendorBL.GetVendor(); tbl_Vendor Vendor = VendorBL.GetByID(VendorId); if (Vendor != null) { VM.VendorID = Vendor.VendorID; VM.Name1 = Vendor.Name1; VM.Address1 = Vendor.Address1; VM.Address2 = Vendor.Address2; VM.Address3 = Vendor.Address3; VM.POBox = Vendor.POBox; VM.City = Vendor.City; VM.Region = Vendor.Region; VM.Country = Vendor.Country; VM.Contact = Vendor.Contact; VM.Phone = Vendor.Phone; VM.Fax = Vendor.Fax; } else { Vendor = new tbl_Vendor(); } return(PartialView("~/Views/Vendor/Partial/_VendorDetailsPartial.cshtml", VM)); }
public ActionResult Orderview() { try { string name = Session["Vendor"].ToString(); tbl_Vendor vd = db.tbl_Vendor.Where(i => i.Email == name).FirstOrDefault(); int id = vd.Vendor_id; ViewBag.order = db.tblOrders.Where(i => i.Vendor == id).ToList(); } catch { } return(View()); }
public string InsertOrUpdateVendor(VendorModel VM) { tbl_Vendor Vendor = new tbl_Vendor(); Vendor.VendorID = VM.VendorID; Vendor.Name1 = VM.Name1; Vendor.Address1 = VM.Address1; Vendor.Address2 = VM.Address2; Vendor.Address3 = VM.Address3; Vendor.POBox = VM.POBox; Vendor.Contact = VM.Contact; Vendor.Phone = VM.Phone; Vendor.Fax = VM.Fax; Vendor.Email = VM.Email; Vendor.City = VM.City; Vendor.Region = VM.Region; Vendor.Country = VM.Country; return(VendorBL.InsertOrUpdate(VM)); }
public VendorViewModel AddVendor(VendorViewModel entity) { var data = new tbl_Vendor { VendorId = entity.vendorId, Vendor = entity.vendor, Address = entity.address, PhoneNo = entity.phoneNo, CreatedBy = "admin", CreatedOn = DateTime.Now, ModifiedBy = "admin", ModifiedOn = DateTime.Now, IsActive = entity.isActive }; context.tbl_Vendor.Add(data); context.SaveChanges(); return(entity); }
/// <summary> /// Update Vendir by Vendor model /// </summary> /// <param name="terminal"></param> /// <returns></returns> public string Update(tbl_Vendor vendor) { try { Context.Vendor.Update(vendor); Context.Vendor.Save(); return(vendor.VendorID + " Updated Successfully!!"); } catch (Exception ex) { //POS Log Exception to db table return("Error in saving details, Please try again!!"); } finally { // Context = null; } }
public string SaveUpdateVendor(VendorModel model) { string msg = string.Empty; ShomaRMEntities db = new ShomaRMEntities(); int userid = ShomaRM.Models.ShomaGroupWebSession.CurrentUser != null ? ShomaRM.Models.ShomaGroupWebSession.CurrentUser.UserID : 0; if (model.Vendor_ID == 0) { var SaveVendor = new tbl_Vendor() { Vendor_Name = model.Vendor_Name, Mobile_Number = model.Mobile_Number, Email_Id = model.Email_Id, Address = model.Address, State = model.State, City = model.City, Created_By = userid, Created_Date = DateTime.Now.Date }; db.tbl_Vendor.Add(SaveVendor); db.SaveChanges(); msg = "Vendor Save Successfully"; } else { var UpdateVendor = db.tbl_Vendor.Where(co => co.Vendor_ID == model.Vendor_ID).FirstOrDefault(); if (UpdateVendor != null) { UpdateVendor.Vendor_Name = model.Vendor_Name; UpdateVendor.Mobile_Number = model.Mobile_Number; UpdateVendor.Email_Id = model.Email_Id; UpdateVendor.Address = model.Address; UpdateVendor.State = model.State; UpdateVendor.City = model.City; } db.SaveChanges(); msg = "Vendor Updated Successfully"; } db.Dispose(); return(msg); }
/// <summary> /// Insert or Update in tbl_Vendor table -Vinod /// </summary> /// <param name="location"></param> /// <returns></returns> public string InsertOrUpdate(VendorModel VM) { string result = string.Empty; bool IsExist = false; tbl_Vendor Vendor; Vendor = this.GetByID(VM.VendorID); Vendor.VendorID = VM.VendorID; Vendor.Name1 = VM.Name1; Vendor.Address1 = VM.Address1; Vendor.Address2 = VM.Address2; Vendor.Address3 = VM.Address3; Vendor.POBox = VM.POBox; Vendor.Contact = VM.Contact; Vendor.Phone = VM.Phone; Vendor.Fax = VM.Fax; Vendor.Email = VM.Email; Vendor.City = VM.City; Vendor.Region = VM.Region; Vendor.Country = VM.Country; if (Vendor != null) { IsExist = true; } else { Vendor = new tbl_Vendor(); } if (!IsExist) { return(result = this.Insert(Vendor)); } else { return(result = this.Update(Vendor)); } }
public ActionResult EditVendor(FormCollection collect) { int id = Convert.ToInt32(collect["HiddenId"]); try { tbl_Vendor vnd = db.tbl_Vendor.Where(i => i.Vendor_id == id).FirstOrDefault(); vnd.Address = collect["VendorAddress"]; vnd.Mobile = Convert.ToInt64(collect["MobileNumber"]); vnd.Pincode = collect["PinCode"]; vnd.state = collect["State"]; vnd.Pro_Info = collect["ProductInfo"]; vnd.LandLine = Convert.ToInt64(collect["LandLine"]); db.SaveChanges(); ViewBag.Message = "Vendor Details Updated Successfully!!"; } catch { ViewBag.Message = "Vendor Details Not Updated Successfully!!"; } return(Redirect("~/Vendor/Index?Msg=" + ViewBag.Message)); }