Exemplo n.º 1
0
        public ContentResult Search(SearchFilter SearchKey)
        {
            SearchKey.OrderBy = string.IsNullOrEmpty(SearchKey.OrderBy) ? "PositionID" : SearchKey.OrderBy;
            T_COM_Master_PositionCollection collection = T_COM_Master_PositionManager.Search(SearchKey);

            return(Content(JsonConvert.SerializeObject(collection), "application/json"));
        }
Exemplo n.º 2
0
        public static T_COM_Master_PositionCollection Search(SearchFilter value)
        {
            T_COM_Master_PositionCollection items = new T_COM_Master_PositionCollection();
            string key = string.Format(SETTINGS_Search_KEY, value.Keyword);

            if (SystemConfig.AllowSearchCache)
            {
                object obj2 = HttpCache.Get(key);

                if ((obj2 != null))
                {
                    return((T_COM_Master_PositionCollection)obj2);
                }
            }

            using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue))
            {
                HttpResponseMessage response = client.PostAsJsonAsync(Resource + "?method=search", value).GetAwaiter().GetResult();

                if (response.IsSuccessStatusCode)
                {
                    items = response.Content.ReadAsAsync <T_COM_Master_PositionCollection>().GetAwaiter().GetResult();
                }
            }

            if (SystemConfig.AllowSearchCache)
            {
                HttpCache.Max(key, items);
            }
            return(items);
        }
Exemplo n.º 3
0
        /// <summary>
        /// use for scrolling page
        /// </summary>
        /// <returns></returns>
        public ContentResult GetPg(int page, int pagesize)
        {
            string       condition = "";
            SearchFilter SearchKey = SearchFilter.SearchPG(1, page, pagesize, "PositionID", "PositionID", "Desc", condition);
            T_COM_Master_PositionCollection objItem = T_COM_Master_PositionManager.Search(SearchKey);

            return(Content(JsonConvert.SerializeObject(objItem), "application/json"));
        }
Exemplo n.º 4
0
        public JsonResult GetGata([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel)
        {
            SearchFilter SearchKey = SearchFilter.SearchData(1, requestModel, "PositionID", "PositionID");
            T_COM_Master_PositionCollection collection = T_COM_Master_PositionManager.Search(SearchKey);
            int TotalRecord = 0;

            if (collection.Count > 0)
            {
                TotalRecord = collection[0].TotalRecord;
            }
            return(Json(new DataTablesResponse(requestModel.Draw, collection, TotalRecord, TotalRecord), JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 5
0
        public static T_COM_Master_PositionCollection GetbyUser(string CreatedUser)
        {
            T_COM_Master_PositionCollection collection = new T_COM_Master_PositionCollection();
            T_COM_Master_Position           obj;

            using (var reader = SqlHelper.ExecuteReaderService(ModuleConfig.MyConnection, "T_COM_Master_Position_GetAll_byUser", new SqlParameter("@CreatedUser", CreatedUser)))
            {
                while (reader.Read())
                {
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
Exemplo n.º 6
0
        public static T_COM_Master_PositionCollection Search(SearchFilter SearchKey)
        {
            T_COM_Master_PositionCollection collection = new T_COM_Master_PositionCollection();

            using (var reader = SqlHelper.ExecuteReaderService(ModuleConfig.MyConnection, "T_COM_Master_Position_Search", SearchFilterManager.SqlSearchParamNoCompany(SearchKey)))
            {
                while (reader.Read())
                {
                    T_COM_Master_Position obj = new T_COM_Master_Position();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
Exemplo n.º 7
0
        public static T_COM_Master_PositionCollection GetAllItem()
        {
            T_COM_Master_PositionCollection collection = new T_COM_Master_PositionCollection();

            using (var reader = SqlHelper.ExecuteReaderService(ModuleConfig.MyConnection, "T_COM_Master_Position_GetAll", null))
            {
                while (reader.Read())
                {
                    T_COM_Master_Position obj = new T_COM_Master_Position();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
Exemplo n.º 8
0
        /// <summary>
        /// ExportExcel File
        /// </summary>
        /// <returns></returns>
        public string ExportExcel()
        {
            T_COM_Master_PositionCollection collection = T_COM_Master_PositionManager.GetAll();
            DataTable dt       = collection.ToDataTable <T_COM_Master_Position>();
            string    fileName = "T_COM_Master_Position_" + SystemConfig.CurrentDate.ToString("MM-dd-yyyy");

            string[] RemoveColumn = { "CompanyID", "TargetDisplayID", "ReturnDisplay", "TotalRecord", "CreatedUser", "CreatedDate" };
            for (int i = 0; i < RemoveColumn.Length; i++)
            {
                if (dt.Columns.Contains(RemoveColumn[i]))
                {
                    dt.Columns.Remove(RemoveColumn[i]);
                }
            }
            FileInputHelper.ExportExcel(dt, fileName, "T_COM_Master_Position List", false);
            return(fileName);
        }
Exemplo n.º 9
0
        public static T_COM_Master_PositionCollection GetAll()
        {
            T_COM_Master_PositionCollection items = new T_COM_Master_PositionCollection();
            string key  = SETTINGS_ALL_KEY;
            object obj2 = HttpCache.Get(key);

            if ((obj2 != null))
            {
                return((T_COM_Master_PositionCollection)obj2);
            }
            using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue))
            {
                HttpResponseMessage response = client.GetAsync(Resource).GetAwaiter().GetResult();

                if (response.IsSuccessStatusCode)
                {
                    items = response.Content.ReadAsAsync <T_COM_Master_PositionCollection>().GetAwaiter().GetResult();
                }
            }
            HttpCache.Max(key, items);
            return(items);
        }
Exemplo n.º 10
0
        public void ExportExcel(string searchprm)
        {
            DataSet   ds = new DataSet();
            DataTable mydata;
            int       RBVH = 10001;
            //T_CMS_Master_ContractCollection collection = T_CMS_Master_ContractManager.GetAll(false);
            SearchFilter mySearch = BindSearch(searchprm);

            T_CMS_Master_ContractCollection collection = T_CMS_Master_ContractManager.Search(mySearch);

            mydata = collection.ToDataTable <T_CMS_Master_Contract>();
            string fileName = "Contract_" + SystemConfig.CurrentDate.ToString("MM-dd-yyyy");

            string[] RemoveColumn = { "CompanyID",                   "TargetDisplayID",             "ReturnDisplay",            "TotalRecord",
                                      "CreatedUser",                 "CreatedDate",                 "StatusID",                 "ApproverLevel",   "ContractLevel",        "SalutationID", "PositionID",  "LocationID",
                                      "PassportNo",                  "PassportDOI",                 "PassportPOI",              "LabourBookNo",    "LabourDOI",
                                      "LabourPOI",                   "AnnualLeave",                 "EmpTypeID",
                                      "EmpSubTypeID",                "WorkPermitNo",                "WorkPermitFrom",           "WorkPermitTo",
                                      "HomeGrossOffer",              "HomeGrossOfferEffectiveFrom",
                                      "HomeGrossOfferEffectiveTo",   "RelocationallowanceCurrency", "Relocationallowance",
                                      "GoabroadallowanceCurrency",   "Goabroadallowance",           "WaivingallowanceCurrency", "Waivingallowance","HostCountryCurrency",
                                      "HostGrossOfferEffectiveFrom", "HostGrossOfferEffectiveTo",   "Remarks",                  "CreatedBy",       "ModifiedBy",
                                      "ModifiedDate",                "IsActive",                    "OriginalDate",             "WorkFlowStatus",  "HandPhone",            "TempAddress",  "WorkHoursID", "ContractTerm","ProbationsPeriod","IDPOI", "Fullname",
                                      //"FirstName_EN","MiddleName_EN","LastName_EN","ContractNo","EmployeeCode",
                                      "GradeID",                     "CMSOrg",                      "Mode",                     "DeptID",          "ErrorMesssage" };
            for (int i = 0; i < RemoveColumn.Length; i++)
            {
                if (mydata.Columns.Contains(RemoveColumn[i]))
                {
                    mydata.Columns.Remove(RemoveColumn[i]);
                }
            }
            ds.Tables.Add(mydata);

            //DNH Position
            T_COM_Master_PositionCollection deColection = T_COM_Master_PositionManager.GetAll();

            mydata = deColection.ToDataTable <T_COM_Master_Position>();
            ds.Tables.Add(mydata);

            //DNH Grade
            T_COM_Master_GradeCollection objGrades = T_COM_Master_GradeManager.GetAll();

            mydata = objGrades.ToDataTable <T_COM_Master_Grade>();
            ds.Tables.Add(mydata);

            //DN Saluation

            T_CMS_Master_SalutationCollection objSalutation = T_CMS_Master_SalutationManager.GetAll();

            mydata = objSalutation.ToDataTable <T_CMS_Master_Salutation>();
            ds.Tables.Add(mydata);

            //DN Working Hours
            T_CMS_Master_WorkHoursCollection objWK = T_CMS_Master_WorkHoursManager.GetAll();

            //T_CMS_InterfaceLacviet_WorkingHoursCollection objWK = T_CMS_InterfaceLacviet_WorkingHoursManager.GetAll();
            mydata = objWK.ToDataTable <T_CMS_Master_WorkHours>();
            ds.Tables.Add(mydata);

            //DN Working Contract Term
            T_CMS_Static_ContractTermCollection objCT = T_CMS_Static_ContractTermManager.GetAll();

            mydata = objCT.ToDataTable <T_CMS_Static_ContractTerm>();
            ds.Tables.Add(mydata);

            //DN Working Probation
            T_CMS_Static_PeriodOfProbationCollection objPr = T_CMS_Static_PeriodOfProbationManager.GetAll();

            objPr.Add(new T_CMS_Static_PeriodOfProbation()
            {
                ID     = 100,
                Period = 0,
            });
            mydata = objPr.ToDataTable <T_CMS_Static_PeriodOfProbation>();
            ds.Tables.Add(mydata);

            //DN  Degree
            T_COM_Master_DegreeCollection objDg = T_COM_Master_DegreeManager.GetAll();

            mydata = objDg.ToDataTable <T_COM_Master_Degree>();
            ds.Tables.Add(mydata);

            //DN Working Location
            T_COM_Master_LocationCollection objLocation = T_COM_Master_LocationManager.GetAllByEntityID(RBVH);

            mydata = objLocation.ToDataTable <T_COM_Master_Location>();
            ds.Tables.Add(mydata);

            //DN Place of Issues
            T_COM_Master_PlaceOfIssueCollection objPOI = T_COM_Master_PlaceOfIssueManager.GetAll();

            mydata = objPOI.ToDataTable <T_COM_Master_PlaceOfIssue>();
            ds.Tables.Add(mydata);

            //DN Place of Issues
            T_COm_Master_OrgCollection objDepartment = T_COm_Master_OrgManager.GetAll();

            mydata = objDepartment.ToDataTable <T_COm_Master_Org>();
            ds.Tables.Add(mydata);

            // ds.Tables.Add(dt2);
            //ds.Tables.Add(dt3);
            List <string> groupCodeList = new List <string>();

            string[] sheetName = { "Contract", "Position", "Grade", "Saluation", "Working Hours", "Contract Term", "Probation", "Degree", "Location", "Place Of Issue", "Department" };
            List <DropdownModelExcel> listDrop = new List <DropdownModelExcel>()
            {
                new DropdownModelExcel()
                {
                    SheetShowDrop       = 1,
                    SheetDataDrop       = 11,
                    ColumnShowDropData  = 2,
                    RangeSheetData      = "B2:B" + (objDepartment.Count + 1),
                    IsHideSheetDataDrop = true
                },
                new DropdownModelExcel()
                {
                    SheetShowDrop       = 1,
                    SheetDataDrop       = 4,
                    ColumnShowDropData  = 3,
                    RangeSheetData      = "B2:B" + (objSalutation.Count + 1),
                    IsHideSheetDataDrop = true
                },
                new DropdownModelExcel()
                {
                    SheetShowDrop       = 1,
                    SheetDataDrop       = 3,
                    ColumnShowDropData  = 10,
                    RangeSheetData      = "B2:B" + (objGrades.Count + 1),
                    IsHideSheetDataDrop = true
                },
                new DropdownModelExcel()
                {
                    SheetShowDrop       = 1,
                    SheetDataDrop       = 2,
                    ColumnShowDropData  = 11, //column 12
                    RangeSheetData      = "B2:B" + (deColection.Count + 1),
                    IsHideSheetDataDrop = true
                },//location
                new DropdownModelExcel()
                {
                    SheetShowDrop       = 1,
                    SheetDataDrop       = 9,
                    ColumnShowDropData  = 16, //column 16 -Location
                    RangeSheetData      = "B2:B" + (objLocation.Count + 1),
                    IsHideSheetDataDrop = true
                },
                new DropdownModelExcel()
                {
                    SheetShowDrop       = 1,
                    SheetDataDrop       = 5,
                    ColumnShowDropData  = 17, //column 16
                    RangeSheetData      = "B2:B" + (objWK.Count + 1),
                    IsHideSheetDataDrop = true
                },
                new DropdownModelExcel()
                {
                    SheetShowDrop       = 1,
                    SheetDataDrop       = 6,
                    ColumnShowDropData  = 18, //column 16
                    RangeSheetData      = "B2:B" + (objCT.Count + 1),
                    IsHideSheetDataDrop = true
                },
                //propration Period
                new DropdownModelExcel()
                {
                    SheetShowDrop       = 1,
                    SheetDataDrop       = 7,
                    ColumnShowDropData  = 19, //column 16
                    RangeSheetData      = "B2:B" + (objPr.Count + 1),
                    IsHideSheetDataDrop = true
                },
                new DropdownModelExcel()
                {
                    SheetShowDrop       = 1,
                    SheetDataDrop       = 8,
                    ColumnShowDropData  = 25, //column 16
                    RangeSheetData      = "B2:B" + (objDg.Count + 1),
                    IsHideSheetDataDrop = true
                },
                //ID Place of Birth
                new DropdownModelExcel()
                {
                    SheetShowDrop       = 1,
                    SheetDataDrop       = 10,
                    ColumnShowDropData  = 21, //column 16
                    RangeSheetData      = "D2:D" + (objPOI.Count + 1),
                    IsHideSheetDataDrop = true
                },
                //ID Place of issues
                new DropdownModelExcel()
                {
                    SheetShowDrop       = 1,
                    SheetDataDrop       = 10,
                    ColumnShowDropData  = 24, //column 16
                    RangeSheetData      = "B2:B" + (objPOI.Count + 1),
                    IsHideSheetDataDrop = true
                },
            };

            //set Column Date Format
            int[]     DateColumn = { 14, 15, 20, 23 };
            ExcelPara mypara     = new ExcelPara()
            {
                ds          = ds,
                sheetName   = sheetName,
                fileName    = fileName,
                list        = listDrop,
                DateColumns = DateColumn,
                DateFormat  = "dd-mmm-yyyy"
            };

            //FileInputHelper.ExportExcel(dt, fileName, "Contract List", false);
            FileInputHelper.ExportMultiSheetExcelExtend(mypara);
            //return fileName;
        }