コード例 #1
0
        public bool UnDeleteCustomer(int id)
        {
            bool            result   = false;
            DeletedCustomer undelobj = new DeletedCustomer();
            Customer        addobj   = new Customer();

            try
            {
                undelobj = _dbcontext.DeletedCustomers.Find(id);
                if (undelobj != null)
                {
                    addobj.FirstName   = undelobj.FirstName;
                    addobj.LastName    = undelobj.LastName;
                    addobj.PhoneNumber = undelobj.PhoneNumber;
                    addobj.EmailID     = undelobj.EmailID;
                    addobj.IsVisited   = undelobj.IsVisited;
                    addobj.LeadSource  = undelobj.LeadSource;
                    addobj.Status      = undelobj.Status;

                    result = AddCustomer(addobj);
                    if (result)
                    {
                        _dbcontext.DeletedCustomers.Remove(undelobj);
                        _dbcontext.SaveChanges();
                    }
                }
            }
            catch (Exception ex) { }
            return(result);
        }
コード例 #2
0
        public bool AddToDeleteTable(Customer delobj, string username)
        {
            bool result = false;

            try
            {
                DeletedCustomer addobj = new DeletedCustomer();
                if (delobj != null)
                {
                    addobj.FirstName   = delobj.FirstName;
                    addobj.LastName    = delobj.LastName;
                    addobj.EmailID     = delobj.EmailID;
                    addobj.PhoneNumber = delobj.PhoneNumber;
                    addobj.Status      = delobj.Status;
                    addobj.LeadSource  = delobj.LeadSource;
                    addobj.IsVisited   = delobj.IsVisited;
                    addobj.DeletedBy   = username;

                    _dbcontext.DeletedCustomers.Add(addobj);
                    _dbcontext.SaveChanges();
                    result = true;
                }
            }
            catch (Exception ex) { }
            return(result);
        }
コード例 #3
0
        public bool DeleteDelTableRecord(int id)
        {
            bool result = false;

            try
            {
                DeletedCustomer obj = new DeletedCustomer();
                obj = _dbcontext.DeletedCustomers.Find(id);
                _dbcontext.DeletedCustomers.Remove(obj);
                _dbcontext.SaveChanges();
                result = true;
            }
            catch (Exception ex) { }
            return(result);
        }