public ActionResult _AjaxList(GridCommand command, IssueMasterSearchModel searchModel)
 {
     SearchStatementModel searchStatementModel = PrepareSearchStatement(command, searchModel);
     GridModel<IssueMaster> List = GetAjaxPageData<IssueMaster>(searchStatementModel, command);
     foreach (IssueMaster issueMaster in List.Data)
     {
         issueMaster.FailCode = base.genericMgr.FindById<FailCode>(issueMaster.FailCode).CodeDescription;
     }
     return PartialView(List);
 }
Example #2
0
 public ActionResult _AjaxList(GridCommand command, IssueMasterSearchModel searchModel)
 {
     SearchStatementModel searchStatementModel = PrepareSearchStatement(command, searchModel);
     return PartialView(GetAjaxPageData<IssueMaster>(searchStatementModel, command));
 }
Example #3
0
 public ActionResult List(GridCommand command, IssueMasterSearchModel searchModel)
 {
     TempData["IssueMasterSearchModel"] = searchModel;
     ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
     return View();
 }
Example #4
0
        private SearchStatementModel PrepareSearchStatement(GridCommand command, IssueMasterSearchModel searchModel)
        {
            string whereStatement = " where ( ";
            whereStatement += "                 im.CreateUserId = " + this.CurrentUser.Id;
            whereStatement += "                  or im.LastModifyUserId = " + this.CurrentUser.Id;
            whereStatement += "                  or im.ReleaseUser = "******"                  or im.StartUser = "******"                  or im.CloseUser = "******"                  or im.CancelUser = "******"                  or im.CompleteUser = "******"                  or exists(select count(det.Id) from IssueDetail det join det.User u where det.IssueCode = im.Code and u.Id = " + this.CurrentUser.Id + " ) ";
            whereStatement += "             ) ";
            IList<object> param = new List<object>();

            HqlStatementHelper.AddLikeStatement("Code", searchModel.Code, HqlStatementHelper.LikeMatchMode.Start, "im", ref whereStatement, param);
            HqlStatementHelper.AddLikeStatement("IssueSubject", searchModel.IssueSubject, HqlStatementHelper.LikeMatchMode.Start, "im", ref whereStatement, param);
            HqlStatementHelper.AddLikeStatement("BackYards", searchModel.BackYards, HqlStatementHelper.LikeMatchMode.Start, "im", ref whereStatement, param);
            HqlStatementHelper.AddLikeStatement("Solution", searchModel.Solution, HqlStatementHelper.LikeMatchMode.Start, "im", ref whereStatement, param);
            HqlStatementHelper.AddLikeStatement("Content", searchModel.Content, HqlStatementHelper.LikeMatchMode.Start, "im", ref whereStatement, param);
            HqlStatementHelper.AddLikeStatement("Email", searchModel.Email, HqlStatementHelper.LikeMatchMode.Start, "im", ref whereStatement, param);
            HqlStatementHelper.AddLikeStatement("MobilePhone", searchModel.MobilePhone, HqlStatementHelper.LikeMatchMode.Start, "im", ref whereStatement, param);
            HqlStatementHelper.AddLikeStatement("UserName", searchModel.UserName, HqlStatementHelper.LikeMatchMode.Start, "im", ref whereStatement, param);


            if (searchModel.DateFrom != null & searchModel.DateTo != null)
            {
                HqlStatementHelper.AddBetweenStatement("CreateDate", searchModel.DateFrom, searchModel.DateTo, "im", ref whereStatement, param);
            }
            else if (searchModel.DateFrom != null & searchModel.DateTo == null)
            {
                HqlStatementHelper.AddGeStatement("CreateDate", searchModel.DateFrom, "im", ref whereStatement, param);
            }
            else if (searchModel.DateFrom == null & searchModel.DateTo != null)
            {
                HqlStatementHelper.AddLeStatement("CreateDate", searchModel.DateTo, "im", ref whereStatement, param);
            }

            HqlStatementHelper.AddEqStatement("Status", searchModel.Status, "im", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("Type", searchModel.Type, "im", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("Priority", searchModel.Priority, "im", ref whereStatement, param);

            HqlStatementHelper.AddEqStatement("Code", searchModel.IssueTypeCode, "it", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("Code", searchModel.IssueNoCode, "ino", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("IssueAddress", searchModel.IssueAddressCode, "im", ref whereStatement, param);

            if (command.SortDescriptors.Count > 0)
            {
                if (command.SortDescriptors[0].Member == "PriorityDescription")
                {
                    command.SortDescriptors[0].Member = "Priority";
                }
                else if (command.SortDescriptors[0].Member == "StatusDescription")
                {
                    command.SortDescriptors[0].Member = "Status";
                }
                else if (command.SortDescriptors[0].Member == "TypeDescription")
                {
                    command.SortDescriptors[0].Member = "Type";
                }
                else if (command.SortDescriptors[0].Member == "Code")
                {
                    command.SortDescriptors[0].Member = "im.Code";
                }
                else if (command.SortDescriptors[0].Member == "IssueTypeCode")
                {
                    command.SortDescriptors[0].Member = "it.Code";
                }
                else if (command.SortDescriptors[0].Member == "IssueTypeDescription")
                {
                    command.SortDescriptors[0].Member = "it.Description";
                }
                else if (command.SortDescriptors[0].Member == "IssueNoDescription")
                {
                    command.SortDescriptors[0].Member = "ino.Description";
                }
                else if (command.SortDescriptors[0].Member == "IssueNoDescription")
                {
                    command.SortDescriptors[0].Member = "in.Description";
                }
                else if (command.SortDescriptors[0].Member == "IssueNoCode")
                {
                    command.SortDescriptors[0].Member = "ino.Code";
                }
                else if (command.SortDescriptors[0].Member == "IssueAddress")
                {
                    command.SortDescriptors[0].Member = "IssueAddr";
                }
                else if (command.SortDescriptors[0].Member == "MobilePhone")
                {
                    command.SortDescriptors[0].Member = "MPhone";
                }
            }

            string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors);


            SearchStatementModel searchStatementModel = new SearchStatementModel();
            searchStatementModel.SelectCountStatement = selectCountStatement;
            searchStatementModel.SelectStatement = selectStatement;
            searchStatementModel.WhereStatement = whereStatement;
            searchStatementModel.SortingStatement = sortingStatement;
            searchStatementModel.Parameters = param.ToArray<object>();

            return searchStatementModel;
        }
Example #5
0
 public ActionResult BatchProcessSearchResult(GridCommand command, IssueMasterSearchModel searchModel)
 {
     SearchCacheModel searchCacheModel = ProcessSearchModel(command, searchModel);
     SearchStatementModel searchStatementModel = PrepareSearchStatement(command, (IssueMasterSearchModel)searchCacheModel.SearchObject);
     return this.PartialView(GetPageData<IssueMaster>(searchStatementModel, command));
 }
Example #6
0
 public ActionResult BatchProcessList(GridCommand command, IssueMasterSearchModel searchModel)
 {
     //SearchCacheModel searchCacheModel = ProcessSearchModel(command, searchModel);
     //SearchStatementModel searchStatementModel = PrepareSearchStatement(command, (IssueMasterSearchModel)searchCacheModel.SearchObject);
     //return View(GetPageData<IssueMaster>(searchStatementModel, command));
     TempData["IssueMasterSearchModel"] = searchModel;
     ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
     return View();
 }
 public ActionResult List(GridCommand command, IssueMasterSearchModel searchModel)
 {
     this.ProcessSearchModel(command, searchModel);
     ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
     return View();
 }