//保存排序 protected void btnSave_Click(object sender, EventArgs e) { BLL.tourgroup bll = new BLL.tourgroup(); Repeater rptList = new Repeater(); rptList = this.rptList1; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); int sortId; if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId)) { sortId = 99; } bll.UpdateField(id, "sort_id=" + sortId.ToString()); } JscriptMsg("保存排序成功啦!", Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}", this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success"); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel(channel_id, DTEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.tourgroup bll = new BLL.tourgroup(); Repeater rptList = new Repeater(); rptList = this.rptList1; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { bll.Delete(id); } } JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}", this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property), "Success"); }
private void RptBind(string _strWhere, string _orderby) { this.page = DTRequest.GetQueryInt("page", 1); if (this.category_id > 0) { this.ddlGroupType.SelectedValue = this.category_id.ToString(); } this.ddlProperty.SelectedValue = this.property; this.txtKeywords.Text = this.keywords; //图表或列表显示 BLL.tourgroup bll = new BLL.tourgroup(); this.rptList1.DataSource = bll.GetTourGroupList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList1.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}&page={4}", this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
//设置操作 protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { ChkAdminLevel(channel_id, DTEnums.ActionEnum.Edit.ToString()); //检查权限 int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value); BLL.tourgroup bll = new BLL.tourgroup(); Model.tourgroup model = bll.GetTourGroupModel(id); switch (e.CommandName.ToLower()) { case "ibtntop": if (model.is_top == 1) bll.UpdateField(id, "is_top=0"); else bll.UpdateField(id, "is_top=1"); break; case "ibtnred": if (model.is_red == 1) bll.UpdateField(id, "is_red=0"); else bll.UpdateField(id, "is_red=1"); break; } this.RptBind("id>0" + CombSqlTxt(this.channel_id, this.category_id, this.keywords, this.property), "sort_id asc,add_time desc"); }
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; }
private void ShowInfo(int _id) { BLL.tourgroup bll = new BLL.tourgroup(); Model.tourgroup model = bll.GetTourGroupModel(_id); ddlGroupType.SelectedValue = model.category_id.ToString(); ddlAccount.SelectedValue = model.account_type.ToString(); ddlFromCity.SelectedValue = model.fromplace_id.ToString(); ddlLanguage.SelectedValue = model.language_type.ToString(); ddlLineCity.SelectedValue = model.linecity_id.ToString(); ddlProperty.SelectedValue = model.group_property.ToString(); ddlRestaurant.SelectedValue = model.restaurant_type.ToString(); ddlTicketType.SelectedValue = model.ticket_type.ToString(); ddlToCity.SelectedValue = model.toplace_id.ToString(); txtTitle.Text = model.title; txtContent.Text = model.book_require; rdoSex.SelectedValue = model.sex.ToString(); rdoStayType.SelectedValue = model.is_stay.ToString(); if (model.is_top == 1) { cblItem.Items[0].Selected = true; } if (model.is_red == 1) { cblItem.Items[1].Selected = true; } txtPeople.Text = model.people_count.ToString(); txtTotal.Text = model.total_count.ToString(); txtServicePrice.Text = model.service_price.ToString(); txtStartDate.Text = model.start_date; txtEndDate.Text = model.end_date; txtSortId.Text = model.sort_id.ToString(); model.status = 1; //0是申请 1是正常 2是过期禁用 //赋值上传的相册 //focus_photo.Value = model.img_url; //封面图片 //LitAlbumList.Text = GetAlbumHtml(model.albums, model.img_url); }
private bool DoEdit(int _id) { bool result = true; BLL.tourgroup bll = new BLL.tourgroup(); Model.tourgroup model = bll.GetTourGroupModel(_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.remark1 = ""; model.remark2 = 0; model.albums = null; if (!bll.Update(model)) { result = false; } return result; }