private ExhibitorLocationEntity GetConsoleExhibitorLocationEntity(DataRow drl)
        {
            ExhibitorLocationEntity item = null;

            if (drl != null)
            {
                item = new ExhibitorLocationEntity();

                if (drl["ExhibitorLocationID"] != null && drl["ExhibitorLocationID"].ToString() != "")
                {
                    item.ExhibitorLocationID = int.Parse(drl["ExhibitorLocationID"].ToString());
                }
                if (drl["ExhibitorID"] != null && drl["ExhibitorID"].ToString() != "")
                {
                    item.ExhibitorID = int.Parse(drl["ExhibitorID"].ToString());
                }
                if (drl["ExhibitorLocation"] != null)
                {
                    item.ExhibitorLocation = drl["ExhibitorLocation"].ToString();
                }
                if (drl["StateTypeID"] != null && drl["StateTypeID"].ToString() != "")
                {
                    item.StateTypeID = int.Parse(drl["StateTypeID"].ToString());
                }
                if (drl["ExhibitiorLocationOrder"] != null && drl["ExhibitiorLocationOrder"].ToString() != "")
                {
                    item.ExhibitiorLocationOrder = int.Parse(drl["ExhibitiorLocationOrder"].ToString());
                }
                if (drl["CreateUserID"] != null)
                {
                    item.CreateUserID = drl["CreateUserID"].ToString();
                }
                if (drl["CreateTime"] != null && drl["CreateTime"].ToString() != "")
                {
                    item.CreateTime = DateTime.Parse(drl["CreateTime"].ToString());
                }
            }

            return(item);
        }
        public string ExhibitorEdit(HttpContext context)
        {
            int    id     = 0;
            int    eid    = 0;
            string ename  = "";
            string eloc   = "";
            bool   ebook  = false;
            bool   estate = false;

            //De(context.Request.Form["rdate"])
            if (int.TryParse(context.Request.Form["eid"], out eid) &&
                !string.IsNullOrEmpty(context.Request.Form["ename"]))
            {
                int.TryParse(context.Request.Form["id"], out id);
                bool.TryParse(context.Request.Form["ebook"], out ebook);
                bool.TryParse(context.Request.Form["estate"], out estate);
                ename = De(context.Request.Form["ename"]);
                eloc  = De(context.Request.Form["eloc"]);

                BCtrl_Exhibitor bll = new BCtrl_Exhibitor();

                ExhibitorEntity item = new ExhibitorEntity()
                {
                    ExhibitionID          = eid,
                    ExhibitorName         = ename,
                    ExhibitorPinYin       = Utils.Hz2Py.GetWholePinyin(ename),
                    IsHadBookList         = ebook,
                    OBCustomerID          = 0,
                    OBCustomerTypeID      = 0,
                    rowId                 = 0,
                    StateTypeID           = estate ? 1 : 0,
                    CreateTime            = DateTime.Now,
                    CreateUserID          = this.CurrentAdmin.Sys_UserID,
                    ExhibitorID           = id,
                    ExhibitorLocationList = new List <ExhibitorLocationEntity>()
                };

                string[] elocs = eloc.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
                if (elocs != null)
                {
                    foreach (string loc in elocs)
                    {
                        ExhibitorLocationEntity locEntity = new ExhibitorLocationEntity()
                        {
                            ExhibitorID             = id,
                            CreateTime              = DateTime.Now,
                            CreateUserID            = this.CurrentAdmin.Sys_UserID,
                            ExhibitiorLocationOrder = 1000,
                            ExhibitorLocation       = loc,
                            ExhibitorLocationID     = 0,
                            StateTypeID             = estate ? 1 : 0
                        };
                        item.ExhibitorLocationList.Add(locEntity);
                    }
                }

                if (id > 0)
                {
                    if (bll.Update_Exhibitor(item))
                    {
                        return(string.Format(G.JSON_OK_STATE_STRING, "修改成功"));
                    }
                    else
                    {
                        return(string.Format(G.JSON_ERROR_STATE_STRING, "修改失败"));
                    }
                }
                else
                {
                    if (bll.Add_Exhibitor(item) > 0)
                    {
                        return(string.Format(G.JSON_OK_STATE_STRING, "添加成功"));
                    }
                    else
                    {
                        return(string.Format(G.JSON_ERROR_STATE_STRING, "添加失败"));
                    }
                }
            }
            else
            {
                return(string.Format(G.JSON_ERROR_STATE_STRING, "参数获取失败"));
            }
        }
        private ExhibitorEntity GetConsoleExhibitorEntity(DataRow dr, DataTable table_location)
        {
            ExhibitorEntity item = null;

            if (dr != null)
            {
                item = new ExhibitorEntity();
                if (dr["ExhibitorID"] != null && dr["ExhibitorID"].ToString() != "")
                {
                    item.ExhibitorID = int.Parse(dr["ExhibitorID"].ToString());
                }
                if (dr["ExhibitionID"] != null && dr["ExhibitionID"].ToString() != "")
                {
                    item.ExhibitionID = int.Parse(dr["ExhibitionID"].ToString());
                }
                if (dr["ExhibitorName"] != null)
                {
                    item.ExhibitorName = dr["ExhibitorName"].ToString();
                }
                if (dr["ExhibitorPinYin"] != null)
                {
                    item.ExhibitorPinYin = dr["ExhibitorPinYin"].ToString();
                }
                if (dr["OBCustomerID"] != null && dr["OBCustomerID"].ToString() != "")
                {
                    item.OBCustomerID = int.Parse(dr["OBCustomerID"].ToString());
                }
                if (dr["OBCustomerTypeID"] != null && dr["OBCustomerTypeID"].ToString() != "")
                {
                    item.OBCustomerTypeID = int.Parse(dr["OBCustomerTypeID"].ToString());
                }
                if (dr["IsHadBookList"] != null && dr["IsHadBookList"].ToString() != "")
                {
                    if ((dr["IsHadBookList"].ToString() == "1") || (dr["IsHadBookList"].ToString().ToLower() == "true"))
                    {
                        item.IsHadBookList = true;
                    }
                    else
                    {
                        item.IsHadBookList = false;
                    }
                }
                if (dr["StateTypeID"] != null && dr["StateTypeID"].ToString() != "")
                {
                    item.StateTypeID = int.Parse(dr["StateTypeID"].ToString());
                }
                if (dr["CreateUserID"] != null)
                {
                    item.CreateUserID = dr["CreateUserID"].ToString();
                }
                if (dr["CreateTime"] != null && dr["CreateTime"].ToString() != "")
                {
                    item.CreateTime = DateTime.Parse(dr["CreateTime"].ToString());
                }
                if (dr["rowId"] != null && dr["rowId"].ToString() != "")
                {
                    item.rowId = int.Parse(dr["rowId"].ToString());
                }

                if (table_location != null)
                {
                    DataRow[] drs = table_location.Select(string.Format(" ExhibitorID = {0} ", item.ExhibitorID.ToShort()));
                    if (drs != null)
                    {
                        item.ExhibitorLocationList = new List <ExhibitorLocationEntity>();
                        foreach (DataRow drl in drs)
                        {
                            ExhibitorLocationEntity locationEntity = this.GetConsoleExhibitorLocationEntity(drl);
                            if (locationEntity != null)
                            {
                                item.ExhibitorLocationList.Add(locationEntity);
                            }
                        }
                    }
                }
            }

            return(item);
        }