/// <summary> /// 显示签证类型 /// </summary> /// <param name="type"></param> /// <returns></returns> public string ShowTypeName(int type) { string strvalue = ""; TravelAgent.Model.VisaType vt = TypeBll.GetModel(type); if (vt != null) { strvalue = vt.Name; } return(strvalue); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["typeid"] != null && int.TryParse(Request.QueryString["typeid"], out typeid)) { TravelAgent.Model.VisaType VisaType = TypeBll.GetModel(typeid); strTypeName = VisaType != null?VisaType.Name:""; } if (Request.QueryString["keyword"] != null) { strKeyName = Request.QueryString["keyword"]; } int.TryParse(Request.QueryString["countryId"], out countryId); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(TravelAgent.Model.VisaType model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into VisaType("); strSql.Append("Name,Sort,isLock)"); strSql.Append(" values ("); strSql.Append("@Name,@Sort,@isLock)"); SqlParameter[] parameters = { new SqlParameter("@Name", SqlDbType.NVarChar, 50), new SqlParameter("@Sort", SqlDbType.Int, 4), new SqlParameter("@isLock", SqlDbType.Int, 4) }; parameters[0].Value = model.Name; parameters[1].Value = model.Sort; parameters[2].Value = model.isLock; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { if (Request.QueryString["id"] != null) { TravelAgent.Model.VisaType model = TypeBll.GetModel(Convert.ToInt32(Request.QueryString["id"])); if (model != null) { this.txtName.Text = model.Name; this.txtSort.Text = model.Sort.ToString(); this.hidId.Value = model.Id.ToString(); this.chkState.Checked = model.isLock == 1; } } else { this.txtSort.Text = (TypeBll.GetMaxID("Sort") + 1).ToString(); } } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(TravelAgent.Model.VisaType model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update VisaType set "); strSql.Append("Name=@Name,"); strSql.Append("Sort=@Sort,"); strSql.Append("isLock=@isLock"); strSql.Append(" where Id=@Id "); SqlParameter[] parameters = { new SqlParameter("@Name", SqlDbType.NVarChar, 50), new SqlParameter("@Sort", SqlDbType.Int, 4), new SqlParameter("@isLock", SqlDbType.Int, 4), new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = model.Name; parameters[1].Value = model.Sort; parameters[2].Value = model.isLock; parameters[3].Value = model.Id; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// 得到一个对象实体 /// </summary> public TravelAgent.Model.VisaType GetModel(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 Id,Name,Sort,isLock from VisaType "); strSql.Append(" where Id=@Id "); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = Id; TravelAgent.Model.VisaType model = new TravelAgent.Model.VisaType(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["Id"].ToString() != "") { model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString()); } model.Name = ds.Tables[0].Rows[0]["Name"].ToString(); if (ds.Tables[0].Rows[0]["Sort"].ToString() != "") { model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString()); } if (ds.Tables[0].Rows[0]["isLock"].ToString() != "") { model.isLock = int.Parse(ds.Tables[0].Rows[0]["isLock"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(TravelAgent.Model.VisaType model) { TypeDAL.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(TravelAgent.Model.VisaType model) { TypeDAL.Add(model); return(TypeDAL.GetMaxID("Id")); }
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { if (Request["tag"] != null) { string strTag = Request["tag"]; if (strTag == "city_save")//领区城市 { int city_editid = Convert.ToInt32(Request["hidId"]); TravelAgent.Model.VisaCity model = new TravelAgent.Model.VisaCity(); model.CityName = Request["txtCityName"]; model.Tips = Request["txtTips"]; model.Sort = Convert.ToInt32(Request["txtSort"]); model.isLock = Request["chkState"] == null?0:1; try { if (city_editid != 0) { model.Id = city_editid; CityBll.Update(model); } else { CityBll.Add(model); } Response.Write("true"); } catch { Response.Write("false"); } } else if (strTag == "city_delete")//出发城市删除 { int cityid = Convert.ToInt32(Request["cityid"]); try { CityBll.Delete(cityid); Response.Write("true"); } catch { Response.Write("false"); } } else if (strTag == "country")//签证国家区域管理 { int c_editid = Convert.ToInt32(Request["hidId"]); int cId; int parentId = Convert.ToInt32(Request["ddlAreaCountry"]); //上一级目录 int Layer = 1; //栏目深度 string List = ""; TravelAgent.Model.VisaCountry country = new TravelAgent.Model.VisaCountry(); country.Name = Request["txtName"]; country.ParentId = parentId; country.PicUrl = Request["txtImgUrl"]; country.Tips = Request["txtTips"]; country.EnglishName = Request["txtEnglishName"]; country.FirstWord = Request["txtFristWord"]; country.ClassList = ""; country.Sort = Convert.ToInt32(Request["txtSort"]); country.isLock = Request["chkState"] == null?0:1; if (c_editid == 0) { //添加 cId = CountryBll.Add(country); } else { cId = c_editid; } //修改 if (parentId > 0) { DataSet ds = CountryBll.GetListByClassId(parentId); if (ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; List = dr["ClassList"].ToString().Trim() + cId + ","; Layer = Convert.ToInt32(dr["ClassLayer"]) + 1; } } else { List = "," + cId + ","; Layer = 1; } country.Id = cId; country.ClassList = List; country.ClassLayer = Layer; try { CountryBll.Update(country); Response.Write("true"); } catch { Response.Write("false"); } } else if (strTag == "country_delete")//删除 { int destid = Convert.ToInt32(Request["countryid"]); try { CountryBll.Delete(destid); Response.Write("true"); } catch { Response.Write("false"); } } else if (strTag == "type_save")//签证类型保存 { int type_editid = Convert.ToInt32(Request["hidId"]); TravelAgent.Model.VisaType model = new TravelAgent.Model.VisaType(); model.Name = Request["txtName"]; model.Sort = Convert.ToInt32(Request["txtSort"]); model.isLock = Request["chkState"] == null?0:1; try { if (type_editid != 0) { model.Id = type_editid; TypeBll.Update(model); } else { TypeBll.Add(model); } Response.Write("true"); } catch { Response.Write("false"); } } else if (strTag == "type_delete")//签证类型删除 { int cityid = Convert.ToInt32(Request["typeid"]); try { TypeBll.Delete(cityid); Response.Write("true"); } catch { Response.Write("false"); } } else if (strTag == "visa_delete")//签证删除 { int visaid = Convert.ToInt32(Request["visaid"]); try { VisaBll.Delete(visaid); Response.Write("true"); } catch { Response.Write("false"); } } } } }