Esempio n. 1
0
        public RBVHSearchFilter BindSearch(string searchprm)
        {
            RBVHSearchFilter SearchKey = new RBVHSearchFilter();

            SearchKey.OrderBy        = "EmployeeCode";
            SearchKey.ColumnsName    = "EmployeeCode,FirstName_EN,MiddleName_EN,LastName_EN,DomainId,EmployeeNo";
            SearchKey.Page           = 1;
            SearchKey.PageSize       = 5000;
            SearchKey.OrderBy        = "EmployeeCode";
            SearchKey.OrderDirection = "Desc";
            SearchKey.CDate          = SystemConfig.CurrentDate;
            SearchKey.Condition      = "";
            RBVHEmployeeSearchpara ObjPara = JsonConvert.DeserializeObject <RBVHEmployeeSearchpara>(searchprm,
                                                                                                    new JsonSerializerSettings
            {
                NullValueHandling = NullValueHandling.Ignore
            });

            if (ObjPara != null)
            {
                if (!string.IsNullOrEmpty(ObjPara.EntityId))
                {
                    SearchKey.EntityID = int.Parse(ObjPara.EntityId);
                }
                if (!string.IsNullOrEmpty(ObjPara.OrgId))
                {
                    SearchKey.Condition += " tbl.GroupCode = " + ObjPara.OrgId + " ";
                }
            }

            return(SearchKey);
        }
Esempio n. 2
0
        /// <summary>
        /// ExportExcel File
        /// </summary>
        /// <returns></returns>
        public string ExportExcel(string searchprm = "")
        {
            RBVHSearchFilter SearchKey = BindSearchHRDB(searchprm);


            RBVHEmployeeCollection collection = RBVHEmployeeManager.Search(SearchKey);

            DataTable dt       = collection.ToDataTable <RBVHEmployee>();
            string    fileName = "RBVHEmployee_" + 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]);
            //    }
            //}
            HeaderItemCollection RemoveColumn = CommonHelper.HideColumn <RBVHEmployee>(CurrentUser, "RBVHEmployee");

            for (int i = 0; i < RemoveColumn.Count; i++)
            {
                if (dt.Columns.Contains(RemoveColumn[i].name))
                {
                    dt.Columns.Remove(RemoveColumn[i].name);
                }
            }

            FileInputHelper.ExportExcel(dt, fileName, "RBVHEmployee List", false);
            return(fileName);
        }
Esempio n. 3
0
        public ContentResult Search(RBVHSearchFilter SearchKey)
        {
            SearchKey.OrderBy = string.IsNullOrEmpty(SearchKey.OrderBy) ? "EmployeeCode" : SearchKey.OrderBy;
            RBVHEmployeeCollection collection = RBVHEmployeeManager.Search(SearchKey);

            return(Content(JsonConvert.SerializeObject(collection), "application/json"));
        }
        public static RBVHEmployeeCollection Search(RBVHSearchFilter value)
        {
            RBVHEmployeeCollection items = new RBVHEmployeeCollection();
            string key = string.Format(SETTINGS_Search_KEY, value.Keyword, value.Page, value.PageSize, value.OrderBy, value.OrderDirection, value.Condition + value.EntityID);

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

                if ((obj2 != null))
                {
                    return((RBVHEmployeeCollection)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 <RBVHEmployeeCollection>().GetAwaiter().GetResult();
                }
            }

            if (SystemConfig.AllowSearchCache && items.Count > 0)
            {
                HttpCache.Max(key, items);
            }
            return(items);
        }
Esempio n. 5
0
        /// <summary>
        /// use for scrolling page
        /// </summary>
        /// <returns></returns>
        public ContentResult GetPg(int page, int pagesize)
        {
            string                 condition = "";
            RBVHSearchFilter       SearchKey = RBVHSearchFilter.SearchPG(1, page, pagesize, "EmployeeCode,FirstName_EN,MiddleName_EN,LastName_EN,DomainId", "EmployeeCode", "Desc", condition);
            RBVHEmployeeCollection objItem   = RBVHEmployeeManager.Search(SearchKey);

            return(Content(JsonConvert.SerializeObject(objItem), "application/json"));
        }
Esempio n. 6
0
        public JsonResult GetActiveData([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel)
        {
            RBVHSearchFilter SearchKey = RBVHSearchFilter.SearchData(1, requestModel, "EmployeeCode,FirstName_EN,MiddleName_EN,LastName_EN,DomainId", "EmployeeCode");

            SearchKey.Condition = " IsActive=0 ";
            RBVHEmployeeCollection collection = RBVHEmployeeManager.Search(SearchKey);
            int TotalRecord = 0;

            if (collection.Count > 0)
            {
                TotalRecord = collection[0].TotalRecord;
            }
            return(Json(new DataTablesResponse(requestModel.Draw, collection, TotalRecord, TotalRecord), JsonRequestBehavior.AllowGet));
        }
Esempio n. 7
0
        public JsonResult GetHRBPSearchData([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel, string searchprm)
        {
            RBVHSearchFilter SearchKey = BindSearchHRDB(searchprm);

            SearchKey = RBVHSearchFilter.SearchData(SearchKey, requestModel);

            RBVHEmployeeCollection collection = RBVHEmployeeManager.Search(SearchKey);
            int TotalRecord = 0;

            if (collection.Count > 0)
            {
                TotalRecord = collection[0].TotalRecord;
            }
            return(Json(new DataTablesResponse(requestModel.Draw, collection, TotalRecord, TotalRecord), JsonRequestBehavior.AllowGet));
        }
Esempio n. 8
0
        public static T_COM_Master_EmployeeCollection Search(RBVHSearchFilter SearchKey)
        {
            T_COM_Master_EmployeeCollection collection = new T_COM_Master_EmployeeCollection();

            using (var reader = SqlHelper.ExecuteReaderService(ModuleConfig.MyConnection, "T_COM_Master_Employee_Search", SearchFilterManager.SqlSearchConditionNoCompany(SearchKey)))
            {
                while (reader.Read())
                {
                    T_COM_Master_Employee obj = new T_COM_Master_Employee();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
Esempio n. 9
0
    public static SqlParameter[] SqlSearchConditionNoCompany(RBVHSearchFilter value)
    {
        var pars = new SqlParameter[]
        {
            new SqlParameter("@Keyword", value.Keyword),
            new SqlParameter("@Columns", value.ColumnsName),
            new SqlParameter("@OrderBy", value.OrderBy),
            new SqlParameter("@OrderDirection", value.OrderDirection),
            new SqlParameter("@Page", value.Page),
            new SqlParameter("@PageSize", value.PageSize),
            // new SqlParameter("@CompanyID",value.CompanyID),
            new SqlParameter("@Condition", value.Condition),
            new SqlParameter("@EntityID", value.EntityID),
            new SqlParameter("@ReportDate", value.CDate),
        };

        return(pars);
    }
Esempio n. 10
0
    public static RBVHSearchFilter SearchData(RBVHSearchFilter SearchKey, [ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel)
    {
        ColumnCollection col     = requestModel.Columns;
        string           OrderBy = SearchKey.OrderBy;

        foreach (Column item in col)
        {
            //if (item.IsOrdered && item.Data!="EmpPoint")
            if (item.IsOrdered)
            {
                OrderBy = item.Data;
                SearchKey.OrderDirection = item.SortDirection == Column.OrderDirection.Ascendant ? "ASC" : "DESC";
                break;
            }
        }
        if (string.IsNullOrEmpty(SearchKey.Keyword))
        {
            SearchKey.Keyword = requestModel.Search.Value;
        }
        SearchKey.Page     = (requestModel.Start / requestModel.Length) + 1;
        SearchKey.PageSize = requestModel.Length;
        return(SearchKey);
    }
Esempio n. 11
0
 // GET api/<controller>
 /// <summary>
 /// Gets this instance.
 /// </summary>
 /// <returns></returns>
 public T_COM_Master_EmployeeCollection Post(string method, [FromBody] RBVHSearchFilter value)
 {
     return(T_COM_Master_EmployeeManager.Search(value));
 }