Exemple #1
0
        public ActionResult RequestType()
        {
            var model = new RequestTypeListModel();
            //model.Active = _comm.GetActiveList();
            //model.Fields = GetFields();

            HttpSessionStateBase session = HttpContext.Session;

            return(View(model));
        }
Exemple #2
0
        public ActionResult InsertRequestType(RequestTypeListModel model)
        {
            HttpSessionStateBase session = HttpContext.Session;

            try
            {
                // update process
                Tbl_RequestType tg = new Tbl_RequestType();
                tg.Description       = model.Description;
                tg.RequestTypeName   = model.RequestTypeName;
                tg.RequestType_ID    = model.RequestType_ID;
                tg.LastUpdateUser_ID = Convert.ToInt32(session["UserID"]);
                tg.LastUpdateDate    = DateTime.Now.ToString("yyyy-MM-dd");
                tg.LastUpdateTime    = DateTime.Now.ToString("HH:mm");
                if (_supportService.AddNewRequestType(tg))
                {
                    var gridModel = new DataSourceResult
                    {
                        ExtraData = new RequestTypeListModel
                        {
                            Message      = Message.OperationSuccessful,
                            MessageColor = "green",
                        },
                        Total = 1
                    };
                    return(Json(gridModel));
                }
                else
                {
                    var gridModel = new DataSourceResult
                    {
                        ExtraData = new RequestTypeListModel
                        {
                            Message      = Message.OperationUnsuccessful,
                            MessageColor = "red",
                        },
                        Total = 1
                    };
                    return(Json(gridModel));
                }
            }
            catch (Exception ex)
            {
                var gridModel = new DataSourceResult
                {
                    ExtraData = new RequestTypeListModel
                    {
                        Message      = Message.OperationUnsuccessful,
                        MessageColor = "red",
                    },
                    Total = 1
                };
                return(Json(gridModel));
            }
        }
Exemple #3
0
        public virtual ActionResult RequestTypeList(DataSourceRequest command, RequestTypeListModel model)
        {
            if (string.IsNullOrEmpty(model.RequestTypeName) && string.IsNullOrEmpty(model.Description))
            {
                var Items     = _supportService.GetAllRequestTypes();
                var gridModel = new DataSourceResult
                {
                    Data = Items.Select(x => new RequestTypeListModel
                    {
                        RequestTypeName = x.RequestTypeName,
                        Description     = x.Description,
                        RequestType_ID  = x.RequestType_ID
                    }),
                    Total = Items.Count()
                };

                return(Json(gridModel));
            }
            else
            {
                //var UserItems = _groupService.SearchCustomer(model.GroupName, model.Description);
                var UserItems = _supportService.SearchRequestType(model.RequestTypeName, model.Description);
                var gridModel = new DataSourceResult
                {
                    Data = UserItems.Select(x => new RequestTypeListModel
                    {
                        RequestTypeName = x.RequestTypeName,
                        Description     = x.Description,
                        RequestType_ID  = x.RequestType_ID
                    }),
                    Total = UserItems.Count()
                };

                return(Json(gridModel));
            }
        }