예제 #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TravelAgent.Model.DepartureCity GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

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

            TravelAgent.Model.DepartureCity model = new TravelAgent.Model.DepartureCity();
            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();
                if (ds.Tables[0].Rows[0]["Sort"].ToString() != "")
                {
                    model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString());
                }
                model.isLock = int.Parse(ds.Tables[0].Rows[0]["isLock"].ToString());
                return(model);
            }
            else
            {
                return(null);
            }
        }
예제 #2
0
        /// <summary>
        /// 显示城市名称
        /// </summary>
        /// <param name="cityId"></param>
        /// <returns></returns>
        public string ShowCityName(int cityId)
        {
            string strCityName = "";

            TravelAgent.Model.DepartureCity cityModel = CityBll.GetModel(cityId);
            if (cityModel != null)
            {
                strCityName = cityModel.CityName;
            }

            return(strCityName);
        }
예제 #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(TravelAgent.Model.DepartureCity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into DepartureCity(");
            strSql.Append("CityName,Sort,isLock)");
            strSql.Append(" values (");
            strSql.Append("@CityName,@Sort,@isLock)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CityName", SqlDbType.NVarChar, 50),
                new SqlParameter("@Sort",     SqlDbType.Int,       4),
                new SqlParameter("@isLock",   SqlDbType.Int, 4)
            };
            parameters[0].Value = model.CityName;
            parameters[1].Value = model.Sort;
            parameters[2].Value = model.isLock;
            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
예제 #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         if (Request.QueryString["cityid"] != null)
         {
             TravelAgent.Model.DepartureCity model = CityBll.GetModel(Convert.ToInt32(Request.QueryString["cityid"]));
             if (model != null)
             {
                 this.txtCityName.Text  = model.CityName;
                 this.txtSort.Text      = model.Sort.ToString();
                 this.hidId.Value       = model.id.ToString();
                 this.chkIsLock.Checked = model.isLock == 1;
             }
         }
         else
         {
             this.txtSort.Text = (CityBll.GetMaxID("Sort") + 1).ToString();
         }
     }
 }
예제 #5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(TravelAgent.Model.DepartureCity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update DepartureCity set ");
            strSql.Append("CityName=@CityName,");
            strSql.Append("Sort=@Sort,");
            strSql.Append("isLock=@isLock");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CityName", 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.CityName;
            parameters[1].Value = model.Sort;
            parameters[2].Value = model.isLock;
            parameters[3].Value = model.id;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
예제 #6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(TravelAgent.Model.DepartureCity model)
 {
     CityDAL.Update(model);
 }
예제 #7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(TravelAgent.Model.DepartureCity model)
 {
     CityDAL.Add(model);
     return(CityDAL.GetMaxID("Id"));
 }
예제 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                if (Request["tag"] != null)
                {
                    string strTag = Request["tag"];
                    if (strTag == "dest")//目的地设置
                    {
                        int    nav_editid = Convert.ToInt32(Request["hidId"]);
                        int    navId;
                        int    parentId = Convert.ToInt32(Request["ddlDest"]);    //上一级目录
                        int    navLayer = 1;                                      //栏目深度
                        string navList  = "";
                        TravelAgent.Model.Destination dest = new TravelAgent.Model.Destination();
                        dest.navName     = Request["txtDestName"];
                        dest.navParentId = parentId;
                        dest.navURL      = Request["txtDestURL"];
                        dest.navList     = "";
                        dest.navSort     = Convert.ToInt32(Request["txtSort"]);
                        dest.kindId      = this.kindId;
                        dest.State       = Request["hidState"];
                        dest.isLock      = Request["chkLock"] == null ? 0 : 1;
                        if (nav_editid == 0)
                        {
                            //添加导航
                            navId = DestBll.Add(dest);
                            CacheHelper.Clear("dest");
                        }
                        else
                        {
                            navId = nav_editid;
                        }
                        //修改导航的下属导航ID列表
                        if (parentId > 0)
                        {
                            DataSet ds = DestBll.GetDestListByClassId(parentId);

                            if (ds.Tables[0].Rows.Count > 0)
                            {
                                DataRow dr = ds.Tables[0].Rows[0];
                                navList  = dr["navList"].ToString().Trim() + navId + ",";
                                navLayer = Convert.ToInt32(dr["navLayer"]) + 1;
                            }
                        }
                        else
                        {
                            navList  = "," + navId + ",";
                            navLayer = 1;
                        }
                        dest.Id       = navId;
                        dest.navList  = navList;
                        dest.navLayer = navLayer;

                        try
                        {
                            DestBll.Update(dest);
                            CacheHelper.Clear("dest");
                            Response.Write("true");
                        }
                        catch
                        {
                            Response.Write("false");
                        }
                    }
                    else if (strTag == "dest_delete")//删除目的地
                    {
                        int destid = Convert.ToInt32(Request["destid"]);
                        try
                        {
                            DestBll.Delete(destid);
                            CacheHelper.Clear("dest");
                            Response.Write("true");
                        }
                        catch
                        {
                            Response.Write("false");
                        }
                    }
                    else if (strTag == "property_save")//参团性质保存
                    {
                        int property_editid = Convert.ToInt32(Request["hidId"]);
                        TravelAgent.Model.JoinProperty model = new TravelAgent.Model.JoinProperty();
                        model.joinName = Request["txtPropertyName"];
                        model.joinSort = Convert.ToInt32(Request["txtSort"]);
                        model.isLock   = Request["chkIsLock"] == null?0:1;
                        try
                        {
                            if (property_editid != 0)
                            {
                                model.id = property_editid;
                                PropertyBll.Update(model);
                            }
                            else
                            {
                                PropertyBll.Add(model);
                            }
                            Response.Write("true");
                        }
                        catch
                        {
                            Response.Write("false");
                        }
                    }
                    else if (strTag == "property_delete")//参团性质删除
                    {
                        int proid = Convert.ToInt32(Request["proid"]);
                        try
                        {
                            PropertyBll.Delete(proid);
                            Response.Write("true");
                        }
                        catch
                        {
                            Response.Write("false");
                        }
                    }
                    else if (strTag == "city_save")//出发城市保存
                    {
                        int city_editid = Convert.ToInt32(Request["hidId"]);
                        TravelAgent.Model.DepartureCity model = new TravelAgent.Model.DepartureCity();
                        model.CityName = Request["txtCityName"];
                        model.Sort     = Convert.ToInt32(Request["txtSort"]);
                        model.isLock   = Request["chkIsLock"] == 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 == "supply_delete")//删除供应商
                    {
                        int supplyid = Convert.ToInt32(Request["supplyid"]);
                        try
                        {
                            SupplyBll.Delete(supplyid);
                            Response.Write("true");
                        }
                        catch
                        {
                            Response.Write("false");
                        }
                    }
                    else if (strTag == "theme_save")//主题保存
                    {
                        int theme_editid = Convert.ToInt32(Request["hidId"]);
                        TravelAgent.Model.LineTheme model = new TravelAgent.Model.LineTheme();
                        model.themeName     = Request["txtThemeName"];
                        model.themeTopPic   = Request["txtImgUrl"];
                        model.themeTopBgPic = "";
                        model.Sort          = Convert.ToInt32(Request["txtSort"]);
                        model.isLock        = Request["chkIsLock"] == null?0:1;
                        try
                        {
                            if (theme_editid != 0)
                            {
                                model.Id = theme_editid;
                                ThemeBll.Update(model);
                            }
                            else
                            {
                                ThemeBll.Add(model);
                            }
                            Response.Write("true");
                        }
                        catch
                        {
                            Response.Write("false");
                        }
                    }
                    else if (strTag == "theme_delete")//出发城市删除
                    {
                        int themeid = Convert.ToInt32(Request["themeid"]);
                        try
                        {
                            ThemeBll.Delete(themeid);
                            Response.Write("true");
                        }
                        catch
                        {
                            Response.Write("false");
                        }
                    }
                    else if (strTag == "insure_save")//保险
                    {
                        int insure_editid = Convert.ToInt32(Request["hidId"]);
                        TravelAgent.Model.Insure model = new TravelAgent.Model.Insure();
                        model.InsureName    = Request["txtInsureName"];
                        model.InsurePrice   = Convert.ToInt32(Request["txtPrice"]);
                        model.InsureContent = Request["txtContent"];
                        model.AddDate       = DateTime.Now;
                        model.IsLock        = Request["chkIsLock"] == null ? 0 : 1;
                        try
                        {
                            if (insure_editid != 0)
                            {
                                model.Id = insure_editid;
                                InsureBll.Update(model);
                            }
                            else
                            {
                                InsureBll.Add(model);
                            }
                            Response.Write("true");
                        }
                        catch
                        {
                            Response.Write("false");
                        }
                    }
                    else if (strTag == "insure_delete")//保险删除
                    {
                        int insureid = Convert.ToInt32(Request["insureid"]);
                        try
                        {
                            if (LineBll.GetCount("insureid=" + insureid) == 0)
                            {
                                InsureBll.Delete(insureid);
                                Response.Write("true");
                            }
                            else
                            {
                                Response.Write("exsit");
                            }
                        }
                        catch
                        {
                            Response.Write("false");
                        }
                    }
                }
            }
        }
예제 #9
0
 /// <summary>
 /// 显示城市名称
 /// </summary>
 /// <param name="cityId"></param>
 /// <returns></returns>
 public string ShowCityName(int cityId)
 {
     TravelAgent.Model.DepartureCity city = CityBll.GetModel(cityId);
     return(city != null ? city.CityName : "");
 }
예제 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int id;

            if (!this.IsPostBack && Request.QueryString["id"] != null && int.TryParse(Request.QueryString["id"], out id))
            {
                LineModel = LineBll.GetModel(id);
                if (LineModel != null)
                {
                    //增加关注度
                    string strsql = "update Line set gzd=gzd+1 where Id=" + LineModel.Id;
                    //Access
                    //TravelAgent.Tool.DbHelperOleDb.ExecuteSql(strsql);
                    //SQL
                    TravelAgent.Tool.DbHelperSQL.ExecuteSql(strsql);

                    if (LineModel.SeoTitle.Trim().Equals(""))
                    {
                        this.Title = LineModel.LineName + "-" + Master.webinfo.WebName + "-" + Master.webinfo.SEOTitle;
                    }
                    else
                    {
                        this.Title = LineModel.SeoTitle;
                    }
                    if (LineModel.SeoKey.Trim().Equals(""))
                    {
                        Common.AddMeta(Page.Master.Page, "keywords", Master.webinfo.SEOKeywords);
                    }
                    else
                    {
                        Common.AddMeta(Page.Master.Page, "keywords", LineModel.SeoKey);
                    }
                    if (LineModel.SeoDisc.Trim().Equals(""))
                    {
                        Common.AddMeta(Page.Master.Page, "description", Master.webinfo.SEODescription);
                    }
                    else
                    {
                        Common.AddMeta(Page.Master.Page, "description", LineModel.SeoDisc);
                    }

                    this.divPlace.InnerHtml = ShowPlace(LineModel);

                    TravelAgent.Model.JoinProperty proModel = ProBll.GetModel(Convert.ToInt32(LineModel.ProIds));
                    if (proModel != null)
                    {
                        this.lblLineType.Text = proModel.joinName;
                    }

                    TravelAgent.Model.DepartureCity cityModel = CityBll.GetModel(LineModel.CityId);
                    if (cityModel != null)
                    {
                        this.lblCity.Text = cityModel.CityName;
                    }

                    int intNormalPrice = String.IsNullOrEmpty(LineModel.PriceContent) ? 0 : Convert.ToInt32(LineModel.PriceContent.Split(',')[2]);
                    int intMinPrice    = GetLineSpePrice(LineModel.Id, intNormalPrice);
                    if (intMinPrice == 0)
                    {
                        this.ltPrice.Text = "电询";
                    }
                    else
                    {
                        this.ltPrice.Text = "¥ " + intMinPrice;
                    }
                }
            }
            if (LineModel == null)
            {
                Response.Redirect("/Opr.aspx?t=error&msg=opr");
            }
        }