Пример #1
0
        public List <Case> SearchCases(string search, bool closed)
        {
            search = search.ToLower();
            ICaseDataAccess data_access = new CaseDataAccess();
            var             data        = data_access.GetAllCases();
            var             found_cases = new List <Case>();
            int             counter     = 0;
            int             closed_id   = 0;

            if (closed == false)
            {
                closed_id = SearchStatus("closed");
            }
            foreach (var case_item in data)
            {
                if (closed == false)
                {
                    if (case_item.status == closed_id)
                    {
                        continue;
                    }
                }
                if (Convert.ToString(case_item.id) == search || case_item.short_description.ToLower().Contains(search) || case_item.description.ToLower().Contains(search))
                {
                    found_cases.Add(new Case {
                        id = case_item.id,
                        short_description = case_item.short_description,
                        description       = case_item.description,
                        customer          = case_item.customer,
                        customer_user     = case_item.customer_user,
                        case_employee     = case_item.case_employee,
                        status            = case_item.status
                    });
                    counter++;
                }
            }
            if (counter == 0)
            {
                var found_users = SearchCustomerUser(search);
                foreach (var case_item in data)
                {
                    foreach (var user in found_users)
                    {
                        if (case_item.customer_user == user.id)
                        {
                            found_cases.Add(new Case {
                                id = case_item.id,
                                short_description = case_item.short_description,
                                description       = case_item.description,
                                customer          = case_item.customer,
                                customer_user     = case_item.customer_user,
                                case_employee     = case_item.case_employee,
                                status            = case_item.status
                            });
                        }
                    }
                }
            }
            return(found_cases);
        }
Пример #2
0
        public bool CreateCase(string short_description, string description, int customer, int customer_user, int case_employee)
        {
            int             status      = 1;
            ICaseDataAccess data_access = new CaseDataAccess();

            return(data_access.CreateCase(short_description, description, customer, customer_user, case_employee, status));
        }
Пример #3
0
        public bool UpdateCase(int id, string short_description, string description, int customer, int customer_user, int case_employee, int status, float time_spent, string hidden_information)
        {
            ICaseDataAccess data_access = new CaseDataAccess();

            return(data_access.UpdateCase(id, short_description, description, customer, customer_user, case_employee, status, time_spent, hidden_information));
        }
Пример #4
0
        public List <Case> GetCase(int id) // Get case by id
        {
            ICaseDataAccess data_access = new CaseDataAccess();

            return(data_access.GetCase(id));
        }
 public CasesController()
 {
     this._caseDataAccess = new CaseDataAccess();
 }