Exemplo n.º 1
0
        /// <summary>
        /// 获取企业项目显示数据源
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public TableModel GetComProjectSoure(object obj)
        {
            FormCollection param  = (FormCollection)obj;
            B01BLL         unit   = new B01BLL();
            TableModel     model  = new TableModel();
            int            rows   = int.Parse(param["rows"]);
            int            page   = int.Parse(param["page"]);
            string         com_id = param["com_id"];

            if (string.IsNullOrEmpty(com_id))
            {
                int        user_id  = HCQ2UI_Helper.OperateContext.Current.Usr.user_id;
                List <B01> unitList = new B01BLL().GetPerUnitByUserID(user_id);
                com_id = unitList[0].in_compay;
            }
            if (string.IsNullOrEmpty(com_id))
            {
                return(model);
            }

            var data = unit.GetB01Info().Where(o => o.in_compay == com_id);

            if (!string.IsNullOrEmpty(param["txtSearchName"]))
            {
                string txtSearchName = param["txtSearchName"];
                data = data.Where(o => o.UnitName.Contains(txtSearchName));
            }

            model.total = data.Count();
            model.rows  = data.Skip((rows * page) - rows).Take(rows);

            return(model);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 用工接口
        /// </summary>
        /// <param name="work"></param>
        /// <returns></returns>
        public object GetApiWorkTime(CheckUseWorker work)
        {
            B01BLL     unit     = new B01BLL();
            List <B01> unitList = unit.GetB01Info();
            var        data     = unitList.Where(o => o.UnitName == work.unitName);

            if (data.Count() > 0)
            {
                string unit_code = data.FirstOrDefault().UnitID;
                return(NoCard(unit_code, work.checkDate));
            }
            else
            {
                //项目名称不正确
                return(null);
            }
        }