コード例 #1
0
ファイル: CRMRepository.cs プロジェクト: harlov-va/st_publish
 public int SaveClient(crm_clients element)
 {
     try
     {
         if (element.id == 0)
         {
             db.crm_clients.Add(element);
             db.SaveChanges();
         }
         else
         {
             try
             {
                 db.Entry(element).State = EntityState.Modified;
                 db.SaveChanges();
             }
             catch (OptimisticConcurrencyException ex)
             {
                 RDL.Debug.LogError(ex);
             }
         }
     }
     catch (Exception ex)
     {
         RDL.Debug.LogError(ex);
     }
     return(element.id);
 }
コード例 #2
0
ファイル: CRMManager.cs プロジェクト: harlov-va/st_publish
        public crm_clients GetClient(int id)
        {
            var res = new crm_clients();

            res = db.GetClient(id);
            return(res);
        }
コード例 #3
0
ファイル: CRMRepository.cs プロジェクト: harlov-va/st_publish
        public crm_clients GetClient(int id)
        {
            var res = new crm_clients();

            res = db.crm_clients.FirstOrDefault(x => x.id == id);
            return(res);
        }
コード例 #4
0
ファイル: CRMManager.cs プロジェクト: harlov-va/st_publish
 public void SaveClient(crm_clients item)
 {
     try
     {
         db.SaveClient(item);
     }
     catch (Exception ex)
     {
         RDL.Debug.LogError(ex);
     }
 }
コード例 #5
0
ファイル: CRMController.cs プロジェクト: harlov-va/st_publish
        public ActionResult CreateClient(string fio,  string note, int sourceID, int statusID)
        {
            var mng = new CRMManager();

            int? sourceID_ = null;
            if (sourceID != 0) sourceID_ = sourceID;

            int? statusID_ = null;
            if (statusID != 0) statusID_=statusID;
            var user = HttpContext.User.Identity.Name;
         
            var item = new crm_clients { 
                id = 0, fio = fio, city=null, note = note, sourceID =sourceID_, statusID = statusID_, addedBy = user,
                created = DateTime.Now, nextContact = DateTime.Now,  subchannel = null,   username = null, needActive = null
            };

            mng.SaveClient(item);

            return Json(new
            {
                result = item.id > 0,
                clientID = item.id
            });
        }