Exemple #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(TravelAgent.Model.VisaCity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update VisaCity set ");
            strSql.Append("CityName=@CityName,");
            strSql.Append("Tips=@Tips,");
            strSql.Append("Sort=@Sort,");
            strSql.Append("isLock=@isLock");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CityName", SqlDbType.NVarChar, 50),
                new SqlParameter("@Tips",     SqlDbType.Text),
                new SqlParameter("@Sort",     SqlDbType.Int,       4),
                new SqlParameter("@isLock",   SqlDbType.Int,       4),
                new SqlParameter("@Id",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.CityName;
            parameters[1].Value = model.Tips;
            parameters[2].Value = model.Sort;
            parameters[3].Value = model.isLock;
            parameters[4].Value = model.Id;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Exemple #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(TravelAgent.Model.VisaCity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into VisaCity(");
            strSql.Append("CityName,Tips,Sort,isLock)");
            strSql.Append(" values (");
            strSql.Append("@CityName,@Tips,@Sort,@isLock)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CityName", SqlDbType.NVarChar, 50),
                new SqlParameter("@Tips",     SqlDbType.Text),
                new SqlParameter("@Sort",     SqlDbType.Int,       4),
                new SqlParameter("@isLock",   SqlDbType.Int, 4)
            };
            parameters[0].Value = model.CityName;
            parameters[1].Value = model.Tips;
            parameters[2].Value = model.Sort;
            parameters[3].Value = model.isLock;
            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         if (Request.QueryString["cityid"] != null)
         {
             TravelAgent.Model.VisaCity model = CityBll.GetModel(Convert.ToInt32(Request.QueryString["cityid"]));
             if (model != null)
             {
                 this.txtCityName.Text = model.CityName;
                 this.txtTips.Value    = model.Tips;
                 this.txtSort.Text     = model.Sort.ToString();
                 this.hidId.Value      = model.Id.ToString();
                 this.chkState.Checked = model.isLock == 1;
             }
         }
         else
         {
             this.txtSort.Text = (CityBll.GetMaxID("Sort") + 1).ToString();
         }
     }
 }
Exemple #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TravelAgent.Model.VisaCity GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,CityName,Tips,Sort,isLock from VisaCity ");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;

            TravelAgent.Model.VisaCity model = new TravelAgent.Model.VisaCity();
            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.CityName = ds.Tables[0].Rows[0]["CityName"].ToString();
                model.Tips     = ds.Tables[0].Rows[0]["Tips"].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);
            }
        }
Exemple #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(TravelAgent.Model.VisaCity model)
 {
     CityDAL.Update(model);
 }
Exemple #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(TravelAgent.Model.VisaCity model)
 {
     CityDAL.Add(model);
     return(CityDAL.GetMaxID("Id"));
 }
Exemple #7
0
        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");
                        }
                    }
                }
            }
        }