/// <summary> /// update a given seller by its fiscal code /// </summary> /// <param name="seller">the given seller</param> /// <param name="user">the logged in user for the instance</param> public void UpdateSellerByFiscalCode(ObjectStructures.Invoice.Seller seller, User user) { #region ActionLog //the log action detailing the command String LogAction = $"S-au actualizat datele societatii cu denumirea {seller.Name}"; //the formatted query command String LogCommand = "UPDATE seller.furnizori " + $"SET denumire = {seller.Name}, " + $"nr_registru_comert = {seller.CommercialRegistryNumber}, " + $"capital_social = {seller.JointStock}, " + $"sediul = {seller.Headquarters}, " + $"punct_lucru = {seller.WorkPoint}, " + $"telefon = {seller.Phone}, " + $"email = {seller.Email}, " + $"WHERE cod_fiscal = {seller.FiscalCode}"; //the instance ip adress String IP = MentorBilling.Miscellaneous.IPFunctions.GetWANIp(); #endregion Furnizori furnizor = base.Furnizori.Where(element => element.CodFiscal == seller.FiscalCode && element.UtilizatorId == user.ID).FirstOrDefault(); seller.DumpIntoDatabaseObject(furnizor); base.Update(furnizor); base.LogActiuni.Add(ActionLog.LogAction(LogAction, IP, LogCommand)); base.SaveChanges(); }
/// <summary> /// update a given seller by id /// </summary> /// <param name="seller">the given seller</param> public void UpdateSellerByID(ObjectStructures.Invoice.Seller seller) { #region ActionLog //the log action detailing the event String LogAction = $"S-au actualizat datele societatii cu denumirea {seller.Name}"; //the formatted log command //for safety reasons it does not contain the image String LogCommand = "UPDATE seller.furnizori " + $"SET denumire = {seller.Name}, " + $"nr_registru_comert = {seller.CommercialRegistryNumber}, " + $"capital_social = {seller.JointStock}, " + $"sediul = {seller.Headquarters}, " + $"punct_lucru = {seller.WorkPoint}, " + $"telefon = {seller.Phone}, " + $"email = {seller.Email}, " + $"WHERE id = {seller.ID}"; //the ip of the instance user String IP = MentorBilling.Miscellaneous.IPFunctions.GetWANIp(); #endregion Furnizori furnizor = base.Furnizori.Find(seller.ID); seller.DumpIntoDatabaseObject(furnizor); base.Update(furnizor); base.LogActiuni.Add(ActionLog.LogAction(LogAction, IP, LogCommand)); base.SaveChanges(); }