public bool InsertFavCompany(int Sup, int CompID) { var svFavcompany = new FavCompanyService(); b2bFavCompany model = new b2bFavCompany(); bool ChkProduct = ValidateInsert(Sup, CompID); if (ChkProduct == true) { model.FavCompCode = Sup + "-" + CompID; model.FavSupplierID = Convert.ToInt32(Sup); model.CompID = CompID; model.FavGroupCompID = 0; model.RowFlag = 1; model.IsShow = true; model.IsDelete = false; model.CreatedDate = DateTimeNow; model.ModifiedDate = DateTimeNow; model.CreatedBy = "sa"; model.ModifiedBy = "sa"; svFavcompany.SaveData(model, "FavCompID"); IsResult = true; } else { IsResult = false; } return(IsResult); }
public ActionResult AddFavSupplier(List <int> SupID) { var svFavCompany = new FavCompanyService(); b2bFavCompany model = new b2bFavCompany(); try { #region Set svFavcompany Model foreach (var Sup in SupID) { var IsResult = svFavCompany.InsertFavCompany(Sup, LogonCompID); if (SupID.Count() == 1) { return(Json(IsResult)); } } #endregion } catch (Exception ex) { CreateLogFiles(ex); } return(Json(new { IsResult = svFavCompany.IsResult, MsgError = GenerateMsgError(svFavCompany.MsgError), ID = model.FavCompID })); }