/// <summary>
 /// 批量转客源
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Update_batch(XHD.Model.CRM_Customer model, string strWhere)
 {
     return(dal.Update_batch(model, strWhere));
 }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Transfer(XHD.Model.CRM_Customer model, XHD.Model.ecs_admin_user adminModel, string c_tel)
 {
     return(dal.Transfer(model, adminModel, c_tel));
 }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(XHD.Model.CRM_Customer model)
 {
     return(dal.Update(model));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(XHD.Model.CRM_Customer model)
 {
     return(dal.Add(model));
 }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <XHD.Model.CRM_Customer> DataTableToList(DataTable dt)
        {
            List <XHD.Model.CRM_Customer> modelList = new List <XHD.Model.CRM_Customer>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                XHD.Model.CRM_Customer model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new XHD.Model.CRM_Customer();
                    if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    if (dt.Rows[n]["Serialnumber"] != null && dt.Rows[n]["Serialnumber"].ToString() != "")
                    {
                        model.Serialnumber = dt.Rows[n]["Serialnumber"].ToString();
                    }
                    if (dt.Rows[n]["Customer"] != null && dt.Rows[n]["Customer"].ToString() != "")
                    {
                        model.Customer = dt.Rows[n]["Customer"].ToString();
                    }
                    if (dt.Rows[n]["address"] != null && dt.Rows[n]["address"].ToString() != "")
                    {
                        model.address = dt.Rows[n]["address"].ToString();
                    }
                    if (dt.Rows[n]["tel"] != null && dt.Rows[n]["tel"].ToString() != "")
                    {
                        model.tel = dt.Rows[n]["tel"].ToString();
                    }
                    if (dt.Rows[n]["fax"] != null && dt.Rows[n]["fax"].ToString() != "")
                    {
                        model.fax = dt.Rows[n]["fax"].ToString();
                    }
                    if (dt.Rows[n]["site"] != null && dt.Rows[n]["site"].ToString() != "")
                    {
                        model.site = dt.Rows[n]["site"].ToString();
                    }
                    if (dt.Rows[n]["industry"] != null && dt.Rows[n]["industry"].ToString() != "")
                    {
                        model.industry = dt.Rows[n]["industry"].ToString();
                    }
                    if (dt.Rows[n]["Provinces_id"] != null && dt.Rows[n]["Provinces_id"].ToString() != "")
                    {
                        model.Provinces_id = int.Parse(dt.Rows[n]["Provinces_id"].ToString());
                    }
                    if (dt.Rows[n]["Provinces"] != null && dt.Rows[n]["Provinces"].ToString() != "")
                    {
                        model.Provinces = dt.Rows[n]["Provinces"].ToString();
                    }
                    if (dt.Rows[n]["City_id"] != null && dt.Rows[n]["City_id"].ToString() != "")
                    {
                        model.City_id = int.Parse(dt.Rows[n]["City_id"].ToString());
                    }
                    if (dt.Rows[n]["City"] != null && dt.Rows[n]["City"].ToString() != "")
                    {
                        model.City = dt.Rows[n]["City"].ToString();
                    }
                    if (dt.Rows[n]["CustomerType_id"] != null && dt.Rows[n]["CustomerType_id"].ToString() != "")
                    {
                        model.CustomerType_id = int.Parse(dt.Rows[n]["CustomerType_id"].ToString());
                    }
                    if (dt.Rows[n]["CustomerType"] != null && dt.Rows[n]["CustomerType"].ToString() != "")
                    {
                        model.CustomerType = dt.Rows[n]["CustomerType"].ToString();
                    }
                    if (dt.Rows[n]["CustomerLevel_id"] != null && dt.Rows[n]["CustomerLevel_id"].ToString() != "")
                    {
                        model.CustomerLevel_id = int.Parse(dt.Rows[n]["CustomerLevel_id"].ToString());
                    }
                    if (dt.Rows[n]["CustomerLevel"] != null && dt.Rows[n]["CustomerLevel"].ToString() != "")
                    {
                        model.CustomerLevel = dt.Rows[n]["CustomerLevel"].ToString();
                    }
                    if (dt.Rows[n]["CustomerSource_id"] != null && dt.Rows[n]["CustomerSource_id"].ToString() != "")
                    {
                        model.CustomerSource_id = int.Parse(dt.Rows[n]["CustomerSource_id"].ToString());
                    }
                    if (dt.Rows[n]["CustomerSource"] != null && dt.Rows[n]["CustomerSource"].ToString() != "")
                    {
                        model.CustomerSource = dt.Rows[n]["CustomerSource"].ToString();
                    }
                    if (dt.Rows[n]["DesCripe"] != null && dt.Rows[n]["DesCripe"].ToString() != "")
                    {
                        model.DesCripe = dt.Rows[n]["DesCripe"].ToString();
                    }
                    if (dt.Rows[n]["Remarks"] != null && dt.Rows[n]["Remarks"].ToString() != "")
                    {
                        model.Remarks = dt.Rows[n]["Remarks"].ToString();
                    }
                    if (dt.Rows[n]["Department_id"] != null && dt.Rows[n]["Department_id"].ToString() != "")
                    {
                        model.Department_id = int.Parse(dt.Rows[n]["Department_id"].ToString());
                    }
                    if (dt.Rows[n]["Department"] != null && dt.Rows[n]["Department"].ToString() != "")
                    {
                        model.Department = dt.Rows[n]["Department"].ToString();
                    }
                    if (dt.Rows[n]["Employee_id"] != null && dt.Rows[n]["Employee_id"].ToString() != "")
                    {
                        model.Employee_id = int.Parse(dt.Rows[n]["Employee_id"].ToString());
                    }
                    if (dt.Rows[n]["Employee"] != null && dt.Rows[n]["Employee"].ToString() != "")
                    {
                        model.Employee = dt.Rows[n]["Employee"].ToString();
                    }
                    if (dt.Rows[n]["privatecustomer"] != null && dt.Rows[n]["privatecustomer"].ToString() != "")
                    {
                        model.privatecustomer = dt.Rows[n]["privatecustomer"].ToString();
                    }
                    if (dt.Rows[n]["lastfollow"] != null && dt.Rows[n]["lastfollow"].ToString() != "")
                    {
                        model.lastfollow = DateTime.Parse(dt.Rows[n]["lastfollow"].ToString());
                    }
                    if (dt.Rows[n]["Create_id"] != null && dt.Rows[n]["Create_id"].ToString() != "")
                    {
                        model.Create_id = int.Parse(dt.Rows[n]["Create_id"].ToString());
                    }
                    if (dt.Rows[n]["Create_name"] != null && dt.Rows[n]["Create_name"].ToString() != "")
                    {
                        model.Create_name = dt.Rows[n]["Create_name"].ToString();
                    }
                    if (dt.Rows[n]["Create_date"] != null && dt.Rows[n]["Create_date"].ToString() != "")
                    {
                        model.Create_date = DateTime.Parse(dt.Rows[n]["Create_date"].ToString());
                    }
                    if (dt.Rows[n]["isDelete"] != null && dt.Rows[n]["isDelete"].ToString() != "")
                    {
                        model.isDelete = int.Parse(dt.Rows[n]["isDelete"].ToString());
                    }
                    if (dt.Rows[n]["Delete_time"] != null && dt.Rows[n]["Delete_time"].ToString() != "")
                    {
                        model.Delete_time = DateTime.Parse(dt.Rows[n]["Delete_time"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
示例#6
0
 /// <summary>
 /// ��������б�
 /// </summary>
 public List<XHD.Model.CRM_Customer> DataTableToList(DataTable dt)
 {
     List<XHD.Model.CRM_Customer> modelList = new List<XHD.Model.CRM_Customer>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         XHD.Model.CRM_Customer model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new XHD.Model.CRM_Customer();
             if(dt.Rows[n]["id"]!=null && dt.Rows[n]["id"].ToString()!="")
             {
                 model.id=int.Parse(dt.Rows[n]["id"].ToString());
             }
             if(dt.Rows[n]["Serialnumber"]!=null && dt.Rows[n]["Serialnumber"].ToString()!="")
             {
             model.Serialnumber=dt.Rows[n]["Serialnumber"].ToString();
             }
             if(dt.Rows[n]["Customer"]!=null && dt.Rows[n]["Customer"].ToString()!="")
             {
             model.Customer=dt.Rows[n]["Customer"].ToString();
             }
             if(dt.Rows[n]["address"]!=null && dt.Rows[n]["address"].ToString()!="")
             {
             model.address=dt.Rows[n]["address"].ToString();
             }
             if(dt.Rows[n]["tel"]!=null && dt.Rows[n]["tel"].ToString()!="")
             {
             model.tel=dt.Rows[n]["tel"].ToString();
             }
             if(dt.Rows[n]["fax"]!=null && dt.Rows[n]["fax"].ToString()!="")
             {
             model.fax=dt.Rows[n]["fax"].ToString();
             }
             if(dt.Rows[n]["site"]!=null && dt.Rows[n]["site"].ToString()!="")
             {
             model.site=dt.Rows[n]["site"].ToString();
             }
             if(dt.Rows[n]["industry"]!=null && dt.Rows[n]["industry"].ToString()!="")
             {
             model.industry=dt.Rows[n]["industry"].ToString();
             }
             if(dt.Rows[n]["Provinces_id"]!=null && dt.Rows[n]["Provinces_id"].ToString()!="")
             {
                 model.Provinces_id=int.Parse(dt.Rows[n]["Provinces_id"].ToString());
             }
             if(dt.Rows[n]["Provinces"]!=null && dt.Rows[n]["Provinces"].ToString()!="")
             {
             model.Provinces=dt.Rows[n]["Provinces"].ToString();
             }
             if(dt.Rows[n]["City_id"]!=null && dt.Rows[n]["City_id"].ToString()!="")
             {
                 model.City_id=int.Parse(dt.Rows[n]["City_id"].ToString());
             }
             if(dt.Rows[n]["City"]!=null && dt.Rows[n]["City"].ToString()!="")
             {
             model.City=dt.Rows[n]["City"].ToString();
             }
             if(dt.Rows[n]["CustomerType_id"]!=null && dt.Rows[n]["CustomerType_id"].ToString()!="")
             {
                 model.CustomerType_id=int.Parse(dt.Rows[n]["CustomerType_id"].ToString());
             }
             if(dt.Rows[n]["CustomerType"]!=null && dt.Rows[n]["CustomerType"].ToString()!="")
             {
             model.CustomerType=dt.Rows[n]["CustomerType"].ToString();
             }
             if(dt.Rows[n]["CustomerLevel_id"]!=null && dt.Rows[n]["CustomerLevel_id"].ToString()!="")
             {
                 model.CustomerLevel_id=int.Parse(dt.Rows[n]["CustomerLevel_id"].ToString());
             }
             if(dt.Rows[n]["CustomerLevel"]!=null && dt.Rows[n]["CustomerLevel"].ToString()!="")
             {
             model.CustomerLevel=dt.Rows[n]["CustomerLevel"].ToString();
             }
             if(dt.Rows[n]["CustomerSource_id"]!=null && dt.Rows[n]["CustomerSource_id"].ToString()!="")
             {
                 model.CustomerSource_id=int.Parse(dt.Rows[n]["CustomerSource_id"].ToString());
             }
             if(dt.Rows[n]["CustomerSource"]!=null && dt.Rows[n]["CustomerSource"].ToString()!="")
             {
             model.CustomerSource=dt.Rows[n]["CustomerSource"].ToString();
             }
             if(dt.Rows[n]["DesCripe"]!=null && dt.Rows[n]["DesCripe"].ToString()!="")
             {
             model.DesCripe=dt.Rows[n]["DesCripe"].ToString();
             }
             if(dt.Rows[n]["Remarks"]!=null && dt.Rows[n]["Remarks"].ToString()!="")
             {
             model.Remarks=dt.Rows[n]["Remarks"].ToString();
             }
             if(dt.Rows[n]["Department_id"]!=null && dt.Rows[n]["Department_id"].ToString()!="")
             {
                 model.Department_id=int.Parse(dt.Rows[n]["Department_id"].ToString());
             }
             if(dt.Rows[n]["Department"]!=null && dt.Rows[n]["Department"].ToString()!="")
             {
             model.Department=dt.Rows[n]["Department"].ToString();
             }
             if(dt.Rows[n]["Employee_id"]!=null && dt.Rows[n]["Employee_id"].ToString()!="")
             {
                 model.Employee_id=int.Parse(dt.Rows[n]["Employee_id"].ToString());
             }
             if(dt.Rows[n]["Employee"]!=null && dt.Rows[n]["Employee"].ToString()!="")
             {
             model.Employee=dt.Rows[n]["Employee"].ToString();
             }
             if(dt.Rows[n]["privatecustomer"]!=null && dt.Rows[n]["privatecustomer"].ToString()!="")
             {
             model.privatecustomer=dt.Rows[n]["privatecustomer"].ToString();
             }
             if(dt.Rows[n]["lastfollow"]!=null && dt.Rows[n]["lastfollow"].ToString()!="")
             {
                 model.lastfollow=DateTime.Parse(dt.Rows[n]["lastfollow"].ToString());
             }
             if(dt.Rows[n]["Create_id"]!=null && dt.Rows[n]["Create_id"].ToString()!="")
             {
                 model.Create_id=int.Parse(dt.Rows[n]["Create_id"].ToString());
             }
             if(dt.Rows[n]["Create_name"]!=null && dt.Rows[n]["Create_name"].ToString()!="")
             {
             model.Create_name=dt.Rows[n]["Create_name"].ToString();
             }
             if(dt.Rows[n]["Create_date"]!=null && dt.Rows[n]["Create_date"].ToString()!="")
             {
                 model.Create_date=DateTime.Parse(dt.Rows[n]["Create_date"].ToString());
             }
             if(dt.Rows[n]["isDelete"]!=null && dt.Rows[n]["isDelete"].ToString()!="")
             {
                 model.isDelete=int.Parse(dt.Rows[n]["isDelete"].ToString());
             }
             if(dt.Rows[n]["Delete_time"]!=null && dt.Rows[n]["Delete_time"].ToString()!="")
             {
                 model.Delete_time=DateTime.Parse(dt.Rows[n]["Delete_time"].ToString());
             }
             if (dt.Rows[n]["isRead"] != null && dt.Rows[n]["isRead"].ToString() != "")
             {
                 model.isRead = int.Parse(dt.Rows[n]["isRead"].ToString());
             }
             if (dt.Rows[n]["isImport"] != null && dt.Rows[n]["isImport"].ToString() != "")
             {
                 model.isImport = int.Parse(dt.Rows[n]["isImport"].ToString());
             }
             if (dt.Rows[n]["Follow_up_dep_id"] != null && dt.Rows[n]["Follow_up_dep_id"].ToString() != "")
             {
                 model.Follow_up_dep_id = int.Parse(dt.Rows[n]["Follow_up_dep_id"].ToString());
             }
             if (dt.Rows[n]["Follow_up_dep"] != null && dt.Rows[n]["Follow_up_dep"].ToString() != "")
             {
                 model.Follow_up_dep = dt.Rows[n]["Follow_up_dep"].ToString();
             }
             if (dt.Rows[n]["Follow_up_id"] != null && dt.Rows[n]["Follow_up_id"].ToString() != "")
             {
                 model.Follow_up_id = int.Parse(dt.Rows[n]["Follow_up_id"].ToString());
             }
             if (dt.Rows[n]["Follow_up"] != null && dt.Rows[n]["Follow_up"].ToString() != "")
             {
                 model.Follow_up = dt.Rows[n]["Follow_up"].ToString();
             }
             if (dt.Rows[n]["To_follow_id"] != null && dt.Rows[n]["To_follow_id"].ToString() != "")
             {
                 model.To_follow_id = int.Parse(dt.Rows[n]["To_follow_id"].ToString());
             }
             if (dt.Rows[n]["To_follow"] != null && dt.Rows[n]["To_follow"].ToString() != "")
             {
                 model.To_follow = dt.Rows[n]["To_follow"].ToString();
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }