Exemple #1
0
        //[CheckSession]
        public virtual ActionResult CustomerSearch(DataSourceRequest command, SupportServicesListModel model)
        {
            //var UserItems = _groupService.SearchCustomer(model.GroupName, model.Description);
            var CustomerItems        = _supportService.SearchCustomers(model.CustomerNameInSearch, model.MobileNo, model.SubscriptionCode, model.TelNo);
            var ProductItems         = _productService.GetAllProducts();
            var CustomerProductItems = _productService.GetAllCustomerProducts();

            var query1 = from cus in CustomerItems
                         join cusprod in CustomerProductItems
                         on cus.Customer_ID equals cusprod.Customer_ID
                         select new
            {
                cus.Customer_ID,
                cus.CustomerName,
                cus.SubscriptionCode,
                cus.TelNo,
                cus.MobileNo,
                cusprod.Products_ID
            };

            var query2 = from qu1 in query1
                         join prod in ProductItems
                         on qu1.Products_ID equals prod.Products_ID
                         select new
            {
                qu1.Customer_ID,
                qu1.CustomerName,
                qu1.SubscriptionCode,
                qu1.TelNo,
                qu1.MobileNo,
                prod.ProductsName
            };



            var gridModel = new DataSourceResult
            {
                Data = query2.Select(x => new SupportServicesModel
                {
                    TelNo                = x.TelNo,
                    SubscriptionCode     = x.SubscriptionCode,
                    MobileNo             = x.MobileNo,
                    Customer_ID          = x.Customer_ID,
                    ProductsName         = x.ProductsName,
                    CustomerNameInSearch = x.CustomerName
                }),
                Total = query2.Count()
            };

            return(Json(gridModel));
        }
Exemple #2
0
        public virtual ActionResult SupportList(DataSourceRequest command, SupportServicesListModel model)
        {
            if (string.IsNullOrEmpty(model.CustomerConnector) && string.IsNullOrEmpty(model.CustomerName) && string.IsNullOrEmpty(model.Description) && string.IsNullOrEmpty(model.Problem) && string.IsNullOrEmpty(model.Guidance) && string.IsNullOrEmpty(model.GuidanceDate))
            {
                var SoftwareItems = _supportService.GetAllSupportService();
                var gridModel     = new DataSourceResult
                {
                    Data = SoftwareItems.Select(x => new SupportServicesListModel
                    {
                        CustomerName      = _customerService.GetCustomerById(x.Customer_ID).CustomerName,
                        CustomerConnector = x.CustomerConnector,
                        GuidanceDate      = x.GuidanceDate,
                        Problem           = x.Problem,
                        Guidance          = x.Guidance,
                        Description       = x.Description,
                        Customer_ID       = x.Customer_ID,
                        Request_ID        = x.Request_ID
                    }),
                    Total = SoftwareItems.Count()
                };

                return(Json(gridModel));
            }
            else
            {
                var SoftwareItems = _supportService.SearchSupport(model.CustomerConnector, model.GuidanceDate, model.Problem, model.Guidance, model.Description);// _softwareService.GetSoftwareOfCusomer(model.Customer_ID);
                var gridModel     = new DataSourceResult
                {
                    Data = SoftwareItems.Select(x => new SupportServicesListModel
                    {
                        CustomerName      = _customerService.GetCustomerById(x.Customer_ID).CustomerName,
                        CustomerConnector = x.CustomerConnector,
                        GuidanceDate      = x.GuidanceDate,
                        Problem           = x.Problem,
                        Guidance          = x.Guidance,
                        Description       = x.Description,
                        Customer_ID       = x.Customer_ID,
                        Request_ID        = x.Request_ID
                    }),
                    Total = SoftwareItems.Count()
                };

                return(Json(gridModel));
            }
        }
Exemple #3
0
        public ActionResult SubmitSupport(DataSourceRequest command, SupportServicesListModel model)
        {
            HttpSessionStateBase session = HttpContext.Session;

            try
            {
                if (false) // field validation
                {
                    var gridModel = new DataSourceResult
                    {
                        ExtraData = new SupportServicesListModel
                        {
                            Message = Message.InvalidCharacter,
                        },
                        Total = 1
                    };
                    return(Json(gridModel));
                }

                Tbl_SupportServices tu = new Tbl_SupportServices();
                tu.Request_ID        = model.Request_ID;
                tu.CustomerConnector = model.CustomerConnector;
                tu.Customer_ID       = model.Customer_ID;
                tu.Description       = model.Description;
                tu.Guidance          = model.Guidance;
                tu.GuidanceDate      = model.GuidanceDate;
                tu.Problem           = model.Problem;
                tu.LastUpdateUser_ID = Convert.ToInt32(session["UserID"]);
                tu.LastUpdateDate    = DateTime.Now.ToString("yyyy-MM-dd");
                tu.LastUpdateTime    = DateTime.Now.ToString("HH:mm");

                if (_supportService.AddNewSupportService(tu))
                {
                    var gridModel = new DataSourceResult
                    {
                        ExtraData = new SupportServicesListModel
                        {
                            Message      = Message.OperationSuccessful,
                            MessageColor = "green"
                        },
                        Total = 1
                    };
                    return(Json(gridModel));
                }
                else
                {
                    var gridModel = new DataSourceResult
                    {
                        ExtraData = new SupportServicesListModel
                        {
                            Message      = Message.OperationUnsuccessful,
                            MessageColor = "red"
                        },
                        Total = 1
                    };
                    return(Json(gridModel));
                }
            }
            catch (Exception ex)
            {
                var gridModel = new DataSourceResult
                {
                    ExtraData = new SupportServicesListModel
                    {
                        Message      = Message.OperationUnsuccessful,
                        MessageColor = "red"
                    },
                    Total = 1
                };
                return(Json(gridModel));
            }
            //return "";
        }