public static void InsertCRMTelephone(CRMTelephone tel) { using (UpsilabEntities db = new UpsilabEntities()) { db.CRMTelephone.Attach(tel); db.ObjectStateManager.ChangeObjectState(tel, System.Data.EntityState.Added); db.SaveChanges(); } }
public static void UpdateCRMTelephone(CRMTelephone tel) { if (tel.idCRMTelephone <= 0) return; using (UpsilabEntities db = new UpsilabEntities()) { var teltoupdate = db.CRMTelephone.Where(f => f.idCRMTelephone == tel.idCRMTelephone).FirstOrDefault(); teltoupdate.Date = tel.Date; teltoupdate.Detail = tel.Detail; teltoupdate.HeureDebut = tel.HeureDebut; teltoupdate.HeureFin = tel.HeureFin; teltoupdate.Objet = tel.Objet; teltoupdate.Type = tel.Type; db.SaveChanges(); } }
public ActionResult InsertAppelTel(CRMTelephone _crmTelephone) { List<FirmInstitution> lstFirmInstitutions = GetData(); try { CRMTelephoneBL.InsertCRMTelephone(_crmTelephone); ViewBag.Style = "style=color:green"; ViewBag.Message = LanguageData.GetContent("appel_tel_bien_enregistee"); } catch (Exception ex) { ViewBag.Style = "style=color:red"; ViewBag.Message = LanguageData.GetContent("exception_titre") + ": " + ex.Message; } return View("Index", GetClients(null, lstFirmInstitutions)); }
public PartialViewResult LoadPopupAppelTel(string id) { try { Guid gCustomerId = Guid.Empty; if (Guid.TryParse(id, out gCustomerId)) { gCustomerId = new Guid(id); } CustomerProspect cp = CustomerProspectBL.GetCustomerProspectById(gCustomerId); if (cp == null) { return PartialView("RetourPartial", LanguageData.GetContent("error_client_not_exists")); } else { CRMTelephone tel = new CRMTelephone() { idClient = gCustomerId }; return PartialView("PopupSaisieAppelTelephoniquePartial", tel); } } catch (Exception ex) { return PartialView("RetourPartial", ex.Message); } }
public ActionResult InsertAppelTel(CRMTelephone _crmTelephone) { try { if (_crmTelephone.idCRMTelephone > 0) CRMTelephoneBL.UpdateCRMTelephone(_crmTelephone); else CRMTelephoneBL.InsertCRMTelephone(_crmTelephone); ViewBag.Style = "style=color:green"; ViewBag.Message = LanguageData.GetContent("appel_tel_bien_enregistee"); } catch (Exception ex) { ViewBag.Style = "style=color:red"; ViewBag.Message = LanguageData.GetContent("exception_titre") + ": " + ex.Message; } return RedirectToAction("Index", new { id = this.idCustomer }); }