public void PublishGroup(string jsondata, string version, string equType, string equName)
        {
            string json_result = string.Empty;
            //解析jsondata
            if (string.IsNullOrEmpty(jsondata))
            {
                json_result = "{\"status\":\"false\",\"data\":\"参数不能为空!\"}";
                Context.Response.Write(json_result);
                HttpContext.Current.ApplicationInstance.CompleteRequest();
                return;
            }
            try
            {
                JavaScriptSerializer serializer = new JavaScriptSerializer();
                Dictionary<string, object> json = (Dictionary<string, object>)serializer.DeserializeObject(jsondata);

                Model.tourgroup model = new Model.tourgroup();
                BLL.tourgroup bll = new BLL.tourgroup();
                int manager_id = 0;
                int.TryParse(json["groupteamid"].ToString(), out manager_id);

                //验证旅行社的有效性
                BLL.manager bll_manager = new BLL.manager();
                Model.manager managerModel = bll_manager.GetModel(manager_id);
                if (managerModel == null || managerModel.is_lock != 0 || DateTime.Parse(managerModel.end_date) < DateTime.Now)
                {
                    json_result = "{\"status\":\"false\",\"data\":\"此旅行社现不能发团,请联系管理员!\"}";
                    Context.Response.Write(json_result);
                    HttpContext.Current.ApplicationInstance.CompleteRequest();
                    return;
                }

                model.manager_id = manager_id;
                model.channel_id = (int)DTEnums.ChannelEnum.lvtuan;
                model.title = json["title"].ToString();
                model.category_id = int.Parse(json["category"].ToString());
                model.content = "";
                model.book_require = json["bookrequire"].ToString();

                #region 类别处理
                //处理类别,根据名称与标识转为类别ID
                int languagetype = 0;
                int accounttype = 0;
                int linecity = 0;
                int property = 0;
                int restauranttype = 0;
                int tickettype = 0;
                int fromplaceid = 0;
                int toplaceid = 0;

                //将省级名称转为ID
                if (json.ContainsKey("fromplace") && !string.IsNullOrEmpty(json["fromplace"].ToString()))
                {
                    fromplaceid = bll_city.GetParentIdByName(json["fromplace"].ToString(), 1);
                    if (fromplaceid == 0)
                    {
                        json_result = "{\"status\":\"false\",\"data\":\"客源地不存在,请重新选择!\"}";
                        Context.Response.Write(json_result);
                        HttpContext.Current.ApplicationInstance.CompleteRequest();
                        return;
                    }
                }
                if (json.ContainsKey("toplace") && !string.IsNullOrEmpty(json["toplace"].ToString()))
                {
                    toplaceid = bll_city.GetParentIdByName(json["toplace"].ToString(), 1);
                    if (toplaceid == 0)
                    {
                        json_result = "{\"status\":\"false\",\"data\":\"目的地不存在,请重新选择!\"}";
                        Context.Response.Write(json_result);
                        HttpContext.Current.ApplicationInstance.CompleteRequest();
                        return;
                    }
                }

                if (json.ContainsKey("languagetype") && !string.IsNullOrEmpty(json["languagetype"].ToString()))
                {
                    languagetype = bll_category.GetCategoryIdByName(json["languagetype"].ToString(), DTEnums.CategoryEnum.language.ToString());
                    if (languagetype == 0)
                    {
                        json_result = "{\"status\":\"false\",\"data\":\"语种类型不存在,请重新选择!\"}";
                        Context.Response.Write(json_result);
                        HttpContext.Current.ApplicationInstance.CompleteRequest();
                        return;
                    }
                }
                if (json.ContainsKey("accounttype") && !string.IsNullOrEmpty(json["accounttype"].ToString()))
                {
                    accounttype = bll_category.GetCategoryIdByName(json["accounttype"].ToString(), DTEnums.CategoryEnum.period.ToString());
                    if (accounttype == 0)
                    {
                        json_result = "{\"status\":\"false\",\"data\":\"账单周期不存在,请重新选择!\"}";
                        Context.Response.Write(json_result);
                        HttpContext.Current.ApplicationInstance.CompleteRequest();
                        return;
                    }
                }
                if (json.ContainsKey("linecity") && !string.IsNullOrEmpty(json["linecity"].ToString()))
                {
                    linecity = bll_category.GetCategoryIdByName(json["linecity"].ToString(), DTEnums.CategoryEnum.world.ToString());
                    if (linecity == 0)
                    {
                        json_result = "{\"status\":\"false\",\"data\":\"国际线路不存在,请重新选择!\"}";
                        Context.Response.Write(json_result);
                        HttpContext.Current.ApplicationInstance.CompleteRequest();
                        return;
                    }
                }
                if (json.ContainsKey("property") && !string.IsNullOrEmpty(json["property"].ToString()))
                {
                    property = bll_category.GetCategoryIdByName(json["property"].ToString(), DTEnums.CategoryEnum.groupteam.ToString());
                    if (property == 0)
                    {
                        json_result = "{\"status\":\"false\",\"data\":\"团属类型不存在,请重新选择!\"}";
                        Context.Response.Write(json_result);
                        HttpContext.Current.ApplicationInstance.CompleteRequest();
                        return;
                    }
                }
                if (json.ContainsKey("restauranttype") && !string.IsNullOrEmpty(json["restauranttype"].ToString()))
                {
                    restauranttype = bll_category.GetCategoryIdByName(json["restauranttype"].ToString(), DTEnums.CategoryEnum.pay.ToString());
                    if (restauranttype == 0)
                    {
                        json_result = "{\"status\":\"false\",\"data\":\"餐厅支付类型不存在,请重新选择!\"}";
                        Context.Response.Write(json_result);
                        HttpContext.Current.ApplicationInstance.CompleteRequest();
                        return;
                    }
                }
                if (json.ContainsKey("tickettype") && !string.IsNullOrEmpty(json["tickettype"].ToString()))
                {
                    tickettype = bll_category.GetCategoryIdByName(json["tickettype"].ToString(), DTEnums.CategoryEnum.pay.ToString());
                    if (tickettype == 0)
                    {
                        json_result = "{\"status\":\"false\",\"data\":\"门票支付类型不存在,请重新选择!\"}";
                        Context.Response.Write(json_result);
                        HttpContext.Current.ApplicationInstance.CompleteRequest();
                        return;
                    }
                }
                #endregion

                model.fromplace_id = fromplaceid;
                model.toplace_id = toplaceid;

                model.account_type = accounttype;
                model.language_type = languagetype;
                model.linecity_id = linecity;
                model.group_property = property;
                model.restaurant_type = restauranttype;
                model.ticket_type = tickettype;

                model.sex = int.Parse(json["sex"].ToString());
                model.is_stay = string.IsNullOrEmpty(json["isstay"].ToString()) ? 0 : int.Parse(json["isstay"].ToString());
                model.is_red = 0;
                model.is_slide = 0;
                model.is_top = 0;

                model.people_count = int.Parse(json["peoplecount"].ToString());
                model.total_count = int.Parse(json["totalcount"].ToString());
                model.service_price = decimal.Parse(json["serviceprice"].ToString());
                model.status = 1; //0申请 1正常 2过期
                model.sort_id = 99;
                model.start_date = json["startdate"].ToString();
                model.end_date = json["enddate"].ToString();
                model.add_time = DateTime.Now;
                model.remark1 = "";
                model.remark2 = 0;

                model.albums = null;
                if (bll.Add(model) < 1)
                {
                    json_result = "{\"status\":\"false\",\"data\":\"发布失败!\"}";
                }
                else
                {
                    json_result = "{\"status\":\"true\",\"data\":\"发布成功!\"}";

                }

            }
            catch (Exception ex)
            {
                json_result = "{\"status\":\"false\",\"data\":\"" + ex.Message + "\"}";
            }
            WriteWebServiceLog(version, equType, equName, "PublishGroup", "");
            Context.Response.Write(json_result);
            Context.Response.End();
        }
        private bool DoAdd()
        {
            bool result = true;
            Model.tourgroup model = new Model.tourgroup();
            BLL.tourgroup bll = new BLL.tourgroup();
            Model.manager managerModel = GetAdminInfo();
            if (managerModel != null)
            {
                model.manager_id = managerModel.id;
            }
            else
            {
                Response.Redirect("../login.aspx");
            }
            model.channel_id = this.channel_id;
            model.title = txtTitle.Text.Trim();
            model.category_id =  int.Parse(ddlGroupType.SelectedValue);
            model.content ="";
            model.book_require = txtContent.Text.Trim();

            model.account_type = string.IsNullOrEmpty(ddlAccount.SelectedValue) ? 0 : int.Parse(ddlAccount.SelectedValue);
            model.fromplace_id = string.IsNullOrEmpty(ddlFromCity.SelectedValue) ? 0 : int.Parse(ddlFromCity.SelectedValue);
            model.language_type = string.IsNullOrEmpty(ddlLanguage.SelectedValue) ? 0 : int.Parse(ddlLanguage.SelectedValue);
            model.linecity_id = string.IsNullOrEmpty(ddlLineCity.SelectedValue) ? 0 : int.Parse(ddlLineCity.SelectedValue);
            model.group_property = string.IsNullOrEmpty(ddlProperty.SelectedValue) ? 0 : int.Parse(ddlProperty.SelectedValue);
            model.restaurant_type = string.IsNullOrEmpty(ddlRestaurant.SelectedValue) ? 0 : int.Parse(ddlRestaurant.SelectedValue);
            model.ticket_type = string.IsNullOrEmpty(ddlTicketType.SelectedValue) ? 0 : int.Parse(ddlTicketType.SelectedValue);
            model.toplace_id = string.IsNullOrEmpty(ddlToCity.SelectedValue) ? 0 : int.Parse(ddlToCity.SelectedValue);
            model.sex = int.Parse(rdoSex.SelectedValue);
            model.is_stay = string.IsNullOrEmpty(rdoStayType.SelectedValue) ? 0 : int.Parse(rdoStayType.SelectedValue);
            model.is_red = 0;
            model.is_slide = 0;
            model.is_top = 0;
            if (cblItem.Items[0].Selected == true)
            {
                model.is_top = 1;
            }
            if (  cblItem.Items[1].Selected == true)
            {
                model.is_red = 1;
            }
            model.people_count = int.Parse(txtPeople.Text.Trim());
            model.total_count = int.Parse(txtTotal.Text.Trim());
            model.service_price = decimal.Parse(txtServicePrice.Text.Trim());
            model.status = 1; //0申请 1正常 2过期
            model.sort_id = int.Parse(txtSortId.Text.Trim());
            model.start_date = txtStartDate.Text.Trim();
            model.end_date = txtEndDate.Text.Trim();
            model.add_time = DateTime.Now;
            model.remark1 = "";
            model.remark2 = 0;

            model.albums = null;
            if (bll.Add(model) < 1)
            {
                result = false;
            }
            return result;
        }