コード例 #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(TravelAgent.Model.Destination model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Destination(");
            strSql.Append("navName,navParentId,navList,navLayer,navSort,navURL,kindId,State,isLock)");
            strSql.Append(" values (");
            strSql.Append("@navName,@navParentId,@navList,@navLayer,@navSort,@navURL,@kindId,@State,@isLock)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@navName",     SqlDbType.NVarChar,  50),
                new SqlParameter("@navParentId", SqlDbType.Int,        4),
                new SqlParameter("@navList",     SqlDbType.NVarChar, 300),
                new SqlParameter("@navLayer",    SqlDbType.Int,        4),
                new SqlParameter("@navSort",     SqlDbType.Int,        4),
                new SqlParameter("@navURL",      SqlDbType.NVarChar, 250),
                new SqlParameter("@kindId",      SqlDbType.Int,        4),
                new SqlParameter("@State",       SqlDbType.VarChar,  100),
                new SqlParameter("@isLock",      SqlDbType.Int)
            };
            parameters[0].Value = model.navName;
            parameters[1].Value = model.navParentId;
            parameters[2].Value = model.navList;
            parameters[3].Value = model.navLayer;
            parameters[4].Value = model.navSort;
            parameters[5].Value = model.navURL;
            parameters[6].Value = model.kindId;
            parameters[7].Value = model.State;
            parameters[8].Value = model.isLock;
            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
コード例 #2
0
        /// <summary>
        /// 显示位置
        /// </summary>
        /// <param name="strPro"></param>
        /// <returns></returns>
        public string ShowPlace(TravelAgent.Model.Line Line)
        {
            StringBuilder sbPlace = new StringBuilder();

            sbPlace.Append("<span>您当前位置:</span>");
            sbPlace.Append(" <a href=\"" + Master.webinfo.WebDomain + "\">首页</a>&gt;");
            int proId = 0;

            if (!string.IsNullOrEmpty(Line.Dest))
            {
                if (Line.Dest.Contains(","))
                {
                    proId = Convert.ToInt32(Line.Dest.Split(',')[1]);
                }
                else
                {
                    proId = Convert.ToInt32(Line.Dest);
                }
                TravelAgent.Model.Destination dest = DestBll.GetModel(proId);
                string[] arryplace = dest.navList.Split(',');
                for (int i = 0; i < arryplace.Length; i++)
                {
                    if (!string.IsNullOrEmpty(arryplace[i]))
                    {
                        TravelAgent.Model.Destination model = DestBll.GetModel(Convert.ToInt32(arryplace[i]));
                        if (model != null)
                        {
                            sbPlace.Append("<a>" + model.navName + "报价</a>&gt;");
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                sbPlace.Append("<em>" + Line.LineName + "</em>");
            }
            else
            {
                TravelAgent.Model.Destination dest = DestBll.GetModel(Line.DestId);
                if (dest != null)
                {
                    sbPlace.Append("<a>" + dest.navName + "报价</a>&gt;");
                }

                sbPlace.Append("<em>" + Line.LineName + "</em>");
            }

            return(sbPlace.ToString());
        }
コード例 #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TravelAgent.Model.Destination GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,navName,navParentId,navList,navLayer,navSort,navURL,kindId,State,isLock from Destination ");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;

            TravelAgent.Model.Destination model = new TravelAgent.Model.Destination();
            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.navName = ds.Tables[0].Rows[0]["navName"].ToString();
                if (ds.Tables[0].Rows[0]["navParentId"].ToString() != "")
                {
                    model.navParentId = int.Parse(ds.Tables[0].Rows[0]["navParentId"].ToString());
                }
                model.navList = ds.Tables[0].Rows[0]["navList"].ToString();
                if (ds.Tables[0].Rows[0]["navLayer"].ToString() != "")
                {
                    model.navLayer = int.Parse(ds.Tables[0].Rows[0]["navLayer"].ToString());
                }
                if (ds.Tables[0].Rows[0]["navSort"].ToString() != "")
                {
                    model.navSort = int.Parse(ds.Tables[0].Rows[0]["navSort"].ToString());
                }
                model.navURL = ds.Tables[0].Rows[0]["navURL"].ToString();
                if (ds.Tables[0].Rows[0]["kindId"].ToString() != "")
                {
                    model.kindId = int.Parse(ds.Tables[0].Rows[0]["kindId"].ToString());
                }
                model.State  = ds.Tables[0].Rows[0]["State"].ToString();
                model.isLock = int.Parse(ds.Tables[0].Rows[0]["isLock"].ToString());
                return(model);
            }
            else
            {
                return(null);
            }
        }
コード例 #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(TravelAgent.Model.Destination model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Destination set ");
            strSql.Append("navName=@navName,");
            strSql.Append("navParentId=@navParentId,");
            strSql.Append("navList=@navList,");
            strSql.Append("navLayer=@navLayer,");
            strSql.Append("navSort=@navSort,");
            strSql.Append("navURL=@navURL,");
            strSql.Append("kindId=@kindId,");
            strSql.Append("State=@State,");
            strSql.Append("isLock=@isLock");
            strSql.Append(" where Id=@Id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@navName",     SqlDbType.NVarChar,  50),
                new SqlParameter("@navParentId", SqlDbType.Int,        4),
                new SqlParameter("@navList",     SqlDbType.NVarChar, 300),
                new SqlParameter("@navLayer",    SqlDbType.Int,        4),
                new SqlParameter("@navSort",     SqlDbType.Int,        4),
                new SqlParameter("@navURL",      SqlDbType.NVarChar, 250),
                new SqlParameter("@kindId",      SqlDbType.Int,        4),
                new SqlParameter("@State",       SqlDbType.VarChar,  100),
                new SqlParameter("@isLock",      SqlDbType.Int),
                new SqlParameter("@Id",          SqlDbType.Int, 4)
            };
            parameters[0].Value = model.navName;
            parameters[1].Value = model.navParentId;
            parameters[2].Value = model.navList;
            parameters[3].Value = model.navLayer;
            parameters[4].Value = model.navSort;
            parameters[5].Value = model.navURL;
            parameters[6].Value = model.kindId;
            parameters[7].Value = model.State;
            parameters[8].Value = model.isLock;
            parameters[9].Value = model.Id;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                DataBindNav();
                DataBindCheckBoxList();

                if (Request.QueryString["destid"] != null)
                {
                    int navid = Convert.ToInt32(Request.QueryString["destid"]);
                    TravelAgent.Model.Destination dest = DestBll.GetModel(navid);

                    if (dest != null)
                    {
                        this.hidId.Value           = dest.Id.ToString();
                        this.ddlDest.SelectedValue = dest.navParentId.ToString();
                        this.txtDestName.Text      = dest.navName;
                        this.txtDestURL.Text       = dest.navURL;
                        this.txtSort.Text          = dest.navSort.ToString();
                        this.chkLock.Checked       = dest.isLock > 0;
                        foreach (ListItem item in chkState.Items)
                        {
                            //if (TravelAgent.Tool.CommonOprate.IsContainValue(item.Value, dest.State))
                            //{
                            //    item.Selected = true;
                            //}
                            if (dest.State.Contains("," + item.Value + ","))
                            {
                                item.Selected = true;
                            }
                        }
                    }
                }
                else
                {
                    this.txtSort.Text = (DestBll.GetMaxID("navSort") + 1).ToString();
                }
            }
        }
コード例 #6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(TravelAgent.Model.Destination model)
 {
     DestDAL.Update(model);
 }
コード例 #7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(TravelAgent.Model.Destination model)
 {
     DestDAL.Add(model);
     return(DestDAL.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");
                        }
                    }
                }
            }
        }