Exemple #1
0
        private List <Tb_Gys_Import> TurnGysImportList(DataTable table)
        {
            List <Tb_Gys_Import> list = new List <Tb_Gys_Import>();

            foreach (DataRow item in table.Rows)
            {
                Tb_Gys_Import model = new Tb_Gys_Import();
                model.id_gysfl = 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_sys     = item["系统备注"] == null ? "" : item["系统备注"].ToString();
                list.Add(model);
            }
            return(list);
        }
Exemple #2
0
        public BaseResult CheckImportInfo(Tb_Gys_Import model)
        {
            BaseResult br = new BaseResult();

            if (string.IsNullOrEmpty(model.id_gysfl))
            {
                br.Success = false;
                br.Data    = "id_gysfl";
                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);
            }

            br.Success = true;
            return(br);
        }