public PageResult <v_lhproducts_policyModel> GetPolicyProducts(ICPOBILL_PolicyDTO header,
                                                                       v_lhproducts_policyModel where, int index = 1, int size = 35)
        {
            where = ComputeWhere(header, where);
            var helper = new OracleDBHelper();
            var total  = 0;

            string whereStr = helper.GetWhereStr(where);

            List <v_lhproducts_policyModel> resultList = new List <v_lhproducts_policyModel>();

            if (string.IsNullOrEmpty(header.HeadID))
            {
                List <V_LHPRODUCTS_UNPOLICYHEADID> data =
                    helper.GetWithWhereStrByPage <V_LHPRODUCTS_UNPOLICYHEADID>(whereStr, where, index, size);

                total = helper.Count <V_LHPRODUCTS_UNPOLICYHEADID>(whereStr);

                var t = typeof(V_LHPRODUCTS_UNPOLICYHEADID);

                var pis = t.GetProperties().ToList();

                data.ForEach(p =>
                {
                    var item = new v_lhproducts_policyModel();
                    pis.ForEach(pi =>
                    {
                        var value = pi.GetValue(p, null);
                        pi.SetValue(item, value);
                    });
                    resultList.Add(item);
                });
            }
            else
            {
                List <v_lhproducts_policyModel> data =
                    helper.GetWithWhereStrByPage <v_lhproducts_policyModel>(whereStr, where, index, size);

                total      = helper.Count <v_lhproducts_policyModel>(whereStr);
                resultList = data;
            }

            PageResult <v_lhproducts_policyModel> result = new PageResult <v_lhproducts_policyModel>()
            {
                Total = total, Result = resultList
            };

            return(result);
        }
Exemple #2
0
        public List <TB_PREMISEModel> GetJYDW(string keyword)
        {
            try
            {
                List <TB_PREMISEModel> datas = new List <TB_PREMISEModel>();

                string where = "";

                if (!string.IsNullOrEmpty(keyword))
                {
                    where = $" AND (FCODE LIKE '%{keyword}%' OR FNAME LIKE '%{keyword}%' OR FID='{keyword}')";
                }
                else
                {
                    where = "";
                }

                var helper = new OracleDBHelper();

                datas = helper.GetWithWhereStrByPage <TB_PREMISEModel>(where);
                return(datas);
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex);
                throw ex;
            }
        }