public void Delete(SupplierCountry ObjDelete) { var ObjToDelete = _context.SupplierCountrys.SingleOrDefault(m => m.CompanyID == ObjDelete.CompanyID && m.SupplierCountryID == ObjDelete.SupplierCountryID); if (ObjToDelete != null) { _context.SupplierCountrys.Remove(ObjToDelete); } }
private void ButtonAddMapping_Click(object sender, EventArgs e) { SupplierCountry suppCountry = new SupplierCountry(); suppCountry.Country_Code = TextEditCode.Text; _selectedRecord.SupplierCountry.Add(suppCountry); BindSupplierCountry(); GridViewSupplierCountry.FocusedRowHandle = BindingSourceSupplierCountry.Count - 1; }
public ActionResult AddNew() { var userId = User.Identity.GetUserId(); var UserInfo = _unitOfWork.User.GetMyInfo(userId); SupplierCountry Obj = new SupplierCountry { SupplierCountryID = _unitOfWork.SupplierCountry.GetMaxSerial(UserInfo.fCompanyId) }; return(PartialView(Obj)); }
public void Update(SupplierCountry ObjUpdate) { var ObjToUpdate = _context.SupplierCountrys.FirstOrDefault(m => m.CompanyID == ObjUpdate.CompanyID && m.SupplierCountryID == ObjUpdate.SupplierCountryID); if (ObjToUpdate != null) { ObjToUpdate.ArabicName = ObjUpdate.ArabicName; ObjToUpdate.EnglishName = ObjUpdate.EnglishName; ObjToUpdate.InsDateTime = ObjUpdate.InsDateTime; ObjToUpdate.InsUserID = ObjUpdate.InsUserID; } }
private void ButtonDeleteMapping_Click(object sender, EventArgs e) { if (GridViewSupplierCountry.FocusedRowHandle >= 0) { SupplierCountry suppCountry = (SupplierCountry)GridViewSupplierCountry.GetFocusedRow(); _selectedRecord.SupplierCountry.Remove(suppCountry); //Removing from the collection just removes the object from its parent, but does not mark //it for deletion, effectively orphaning it. This will cause foreign key errors when saving. //To flag for deletion, delete it from the context as well. _context.SupplierCountry.DeleteObject(suppCountry); BindSupplierCountry(); } }
private void FinalizeBindings() { BindingSource.EndEdit(); GridViewSupplierCountry.CloseEditor(); GridViewSupplierCountry.UpdateCurrentRow(); //Set the city code for each mapping just in case for (int rowCtr = 0; rowCtr < GridViewSupplierCountry.DataRowCount; rowCtr++) { SupplierCountry suppCountry = (SupplierCountry)GridViewSupplierCountry.GetRow(rowCtr); suppCountry.Country_Code = TextEditCode.Text; } BindingSourceSupplierCountry.EndEdit(); }
public JsonResult UpdateSupplierCountry(SupplierCountry ObjUpdate) { MsgUnit Msg = new MsgUnit(); try { var userId = User.Identity.GetUserId(); var UserInfo = _unitOfWork.User.GetMyInfo(userId); ObjUpdate.CompanyID = UserInfo.fCompanyId; ObjUpdate.InsDateTime = DateTime.Now; ObjUpdate.InsUserID = userId; if (String.IsNullOrEmpty(ObjUpdate.EnglishName)) { ObjUpdate.EnglishName = ObjUpdate.ArabicName; } if (!ModelState.IsValid) { string Err = " "; var errors = ModelState.Values.SelectMany(v => v.Errors); foreach (ModelError error in errors) { Err = Err + error.ErrorMessage + " * "; } Msg.Msg = Resources.Resource.SomthingWentWrong + " : " + Err; Msg.Code = 0; return(Json(Msg, JsonRequestBehavior.AllowGet)); } _unitOfWork.SupplierCountry.Update(ObjUpdate); _unitOfWork.Complete(); Msg.Code = 1; Msg.Msg = Resources.Resource.UpdatedSuccessfully; return(Json(Msg, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { Msg.Msg = Resources.Resource.SomthingWentWrong + " : " + ex.Message.ToString(); Msg.Code = 0; return(Json(Msg, JsonRequestBehavior.AllowGet)); } }
internal override bool isValid() { int requiredFilterCount = SupplierID.NullSafeLength() + LeadTime1.NullSafeLength() + LeadTime2.NullSafeLength() + SupplierCompany.NullSafeLength() + SupplierCurrencyCode.NullSafeLength() + SupplierCity.NullSafeLength() + SupplierState.NullSafeLength() + SupplierCountry.NullSafeLength(); if (requiredFilterCount != 0) { return(true); } throw new NetoRequestException("At least one filter is required in the GetSupplier request"); }
public void Add(SupplierCountry ObjSave) { _context.SupplierCountrys.Add(ObjSave); }