Ejemplo n.º 1
0
        public BaseResult CheckImportInfo(Tb_Kh_Import model)
        {
            BaseResult br = new BaseResult();

            if (string.IsNullOrEmpty(model.id_khfl))
            {
                br.Success = false;
                br.Data    = "id_khfl";
                br.Message.Add("客户分类不能为空");
                return(br);
            }

            //if (string.IsNullOrEmpty(model.bm))
            //{
            //    br.Success = false;
            //    br.Data = "bm";
            //    br.Message.Add("编码不能为空");
            //    return br;
            //}

            if (string.IsNullOrEmpty(model.mc))
            {
                br.Success = false;
                br.Data    = "mc";
                br.Message.Add("名称不能为空");
                return(br);
            }

            if (string.IsNullOrEmpty(model.flag_state) || (model.flag_state != "0" && model.flag_state != "1"))
            {
                br.Success = false;
                br.Data    = "flag_state";
                br.Message.Add("状态不符合要求");
                return(br);
            }

            if (!string.IsNullOrEmpty(model.je_xyed) && !CyVerify.IsNumeric(model.je_xyed))
            {
                br.Success = false;
                br.Data    = "je_xyed";
                br.Message.Add("信用额度不符合要求");
                return(br);
            }

            if (!string.IsNullOrEmpty(model.je_xyed_temp) && !CyVerify.IsNumeric(model.je_xyed_temp))
            {
                br.Success = false;
                br.Data    = "je_xyed_temp";
                br.Message.Add("临时额度不符合要求");
                return(br);
            }


            br.Success = true;
            return(br);
        }
Ejemplo n.º 2
0
        private List <Tb_Kh_Import> TurnKhImportList(DataTable table)
        {
            List <Tb_Kh_Import> list = new List <Tb_Kh_Import>();

            foreach (DataRow item in table.Rows)
            {
                Tb_Kh_Import model = new Tb_Kh_Import();
                model.id_khfl = item["客户分类"] == null ? "" : item["客户分类"].ToString();
                model.bm      = item["编码"] == null ? "" : item["编码"].ToString();
                model.mc      = item["名称"] == null ? "" : item["名称"].ToString();
                decimal flag_state = 0;
                decimal.TryParse(item["状态"] == null ? "" : item["状态"].ToString(), out flag_state);
                model.flag_state = flag_state.ToString();
                model.lxr        = item["联系人"] == null ? "" : item["联系人"].ToString();
                model.tel        = item["联系电话"] == null ? "" : item["联系电话"].ToString();
                model.companytel = item["公司电话"] == null ? "" : item["公司电话"].ToString();
                model.email      = item["邮箱"] == null ? "" : item["邮箱"].ToString();
                model.zipcode    = item["邮编"] == null ? "" : item["邮编"].ToString();
                model.address    = item["地址"] == null ? "" : item["地址"].ToString();
                model.bz         = item["备注"] == null ? "" : item["备注"].ToString();
                model.bz_kh      = item["系统备注"] == null ? "" : item["系统备注"].ToString();


                decimal je_xyed = 0;
                decimal.TryParse(item["信用额度"] == null ? "" : item["信用额度"].ToString(), out je_xyed);
                model.je_xyed = je_xyed.ToString();

                decimal je_xyed_temp = 0;
                decimal.TryParse(item["临时额度"] == null ? "" : item["临时额度"].ToString(), out je_xyed_temp);
                model.je_xyed_temp = je_xyed_temp.ToString();

                if (item["临额开始日期"] != null && !string.IsNullOrEmpty(item["临额开始日期"].ToString()))
                {
                    DateTime rq_xyed_temp_b;
                    DateTime.TryParse(item["临额开始日期"] == null ? "" : item["临额开始日期"].ToString(), out rq_xyed_temp_b);
                    model.rq_xyed_temp_b = rq_xyed_temp_b.ToString();
                }

                if (item["临额结束日期"] != null && !string.IsNullOrEmpty(item["临额结束日期"].ToString()))
                {
                    DateTime rq_xyed_temp_e;
                    DateTime.TryParse(item["临额结束日期"] == null ? "" : item["临额结束日期"].ToString(), out rq_xyed_temp_e);
                    model.rq_xyed_temp_e = rq_xyed_temp_e.ToString();
                }

                list.Add(model);
            }
            return(list);
        }