Exemplo n.º 1
0
        /// <summary>
        /// 写入餐馆供应商信息,正值时成功,负值或0时失败
        /// </summary>
        /// <param name="info">餐馆供应商信息业务实体</param>
        /// <returns>正值:成功 负值或0:失败</returns>
        public int InsertRestaurantInfo(EyouSoft.Model.SupplierStructure.SupplierRestaurantInfo info)
        {
            using (TransactionScope AddTran = new TransactionScope())
            {
                bool dalResult = false;
                EyouSoft.BLL.CompanyStructure.SupplierBaseHandle basicbll = new EyouSoft.BLL.CompanyStructure.SupplierBaseHandle();
                info.Id  = basicbll.AddSupplierBase(info);
                basicbll = null;

                if (info.Id < 1)
                {
                    return(-1);
                }

                dalResult = dal.InsertRestaurantPertain(info);
                if (!dalResult)
                {
                    return(-2);
                }

                AddTran.Complete();
            }

            return(1);
        }
Exemplo n.º 2
0
        private void loadXls()
        {
            string data = Utils.GetFormValue("dataxls");

            string[] s = data.Split(';');

            EyouSoft.BLL.SupplierStructure.SupplierRestaurant srbll = new EyouSoft.BLL.SupplierStructure.SupplierRestaurant();
            IList <EyouSoft.Model.SupplierStructure.SupplierRestaurantInfo> srinfo = new List <EyouSoft.Model.SupplierStructure.SupplierRestaurantInfo>();

            for (int i = 0; i < s.Length; i++)
            {
                string[] smodel = s[i].Split(',');
                if (smodel.Length == 14 && !string.IsNullOrEmpty(smodel[0]) && !string.IsNullOrEmpty(smodel[1]) && !string.IsNullOrEmpty(smodel[2]))
                {
                    EyouSoft.Model.SupplierStructure.SupplierRestaurantInfo srModel = new EyouSoft.Model.SupplierStructure.SupplierRestaurantInfo();
                    srModel.ProvinceName = HttpUtility.UrlDecode(smodel[0]);
                    srModel.CityName     = HttpUtility.UrlDecode(smodel[1]);
                    srModel.UnitName     = HttpUtility.UrlDecode(smodel[2]);
                    srModel.Cuisine      = HttpUtility.UrlDecode(smodel[3]);
                    srModel.UnitAddress  = HttpUtility.UrlDecode(smodel[4]);
                    srModel.Introduce    = HttpUtility.UrlDecode(smodel[5]);
                    srModel.TourGuide    = HttpUtility.UrlDecode(smodel[6]);


                    srModel.SupplierContact = new List <EyouSoft.Model.CompanyStructure.SupplierContact>();
                    EyouSoft.Model.CompanyStructure.SupplierContact contect = new EyouSoft.Model.CompanyStructure.SupplierContact();
                    contect.ContactName   = HttpUtility.UrlDecode(smodel[7]);
                    contect.JobTitle      = HttpUtility.UrlDecode(smodel[8]);
                    contect.ContactTel    = HttpUtility.UrlDecode(smodel[9]);
                    contect.ContactMobile = HttpUtility.UrlDecode(smodel[10]);
                    contect.QQ            = HttpUtility.UrlDecode(smodel[11]);
                    contect.Email         = HttpUtility.UrlDecode(smodel[12]);
                    contect.CompanyId     = SiteUserInfo.CompanyID;
                    srModel.SupplierContact.Add(contect);
                    srModel.Remark = HttpUtility.UrlDecode(smodel[13]);

                    srModel.OperatorId    = SiteUserInfo.ID;
                    srModel.IssueTime     = DateTime.Now;
                    srModel.CompanyId     = CurrentUserCompanyID;
                    srModel.AgreementFile = string.Empty;
                    srModel.IsDelete      = false;
                    srModel.SupplierType  = EyouSoft.Model.EnumType.CompanyStructure.SupplierType.餐馆;
                    srModel.TradeNum      = 0;
                    srModel.Commission    = 0;
                    srinfo.Add(srModel);
                }
            }

            int res = 0;

            res = srbll.InsertRestaurants(srinfo);

            Response.Clear();
            Response.Write(string.Format("{{\"res\":{0}}}", res > 0 ? 1 : -1));
            Response.End();
        }
Exemplo n.º 3
0
        /// <summary>
        /// 写入餐馆供应商附加信息
        /// </summary>
        /// <param name="info">餐馆供应商信息业务实体</param>
        /// <returns></returns>
        public bool InsertRestaurantPertain(EyouSoft.Model.SupplierStructure.SupplierRestaurantInfo info)
        {
            DbCommand cmd = this._db.GetSqlStringCommand(SQL_INSERT_InsertRestaurantPertain);

            this._db.AddInParameter(cmd, "SupplierId", DbType.Int32, info.Id);
            this._db.AddInParameter(cmd, "Cuisine", DbType.String, info.Cuisine);
            this._db.AddInParameter(cmd, "Introduce", DbType.String, info.Introduce);
            this._db.AddInParameter(cmd, "TourGuide", DbType.String, info.TourGuide);

            return(DbHelper.ExecuteSql(cmd, this._db) == 1 ? true : false);
        }
Exemplo n.º 4
0
        protected bool grantto     = false; //导出

        protected void Page_Load(object sender, EventArgs e)
        {
            //实例化餐馆业务逻辑类和实体类
            Restaurantbll  = new EyouSoft.BLL.SupplierStructure.SupplierRestaurant();
            Restaurantinfo = new EyouSoft.Model.SupplierStructure.SupplierRestaurantInfo();

            //权限判断
            if (!CheckGrant(global::Common.Enum.TravelPermission.供应商管理_餐馆_栏目))
            {
                Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.供应商管理_餐馆_栏目, true);
            }

            grantadd    = CheckGrant(global::Common.Enum.TravelPermission.供应商管理_餐馆_新增);
            grantdel    = CheckGrant(global::Common.Enum.TravelPermission.供应商管理_餐馆_删除);
            grantmodify = CheckGrant(global::Common.Enum.TravelPermission.供应商管理_餐馆_修改);
            grantto     = CheckGrant(global::Common.Enum.TravelPermission.供应商管理_餐馆_导出);
            grantload   = CheckGrant(global::Common.Enum.TravelPermission.供应商管理_餐馆_导入);

            //初始化省份和城市
            this.ucProvince1.CompanyId = CurrentUserCompanyID;
            this.ucProvince1.IsFav     = true;
            this.ucCity1.CompanyId     = CurrentUserCompanyID;
            this.ucCity1.IsFav         = true;

            if (!this.Page.IsPostBack)
            {
                //操作权限 删除or导出excel
                action = Utils.GetQueryStringValue("action");
                switch (action)
                {
                case "toexcel":
                {
                    if (grantto)
                    {
                        CreateExcel("Restaurant" + DateTime.Now.ToShortDateString());
                    }
                }
                break;

                case "Restaurantdel":
                {
                    if (grantdel)
                    {
                        RestaurantDel();
                    }
                }
                break;

                default:
                    DataInit();
                    break;
                }
            }
        }
Exemplo n.º 5
0
        protected void bind()
        {
            int tid = Utils.GetInt(Utils.GetQueryStringValue("tid"));

            if (tid > 0)
            {
                Restaurantinfo = RestaurantBll.GetRestaurantInfo(tid);
                this.ucProvince1.ProvinceId = Restaurantinfo.ProvinceId;
                this.ucCity1.CityId         = Restaurantinfo.CityId;
                this.ucCity1.ProvinceId     = Restaurantinfo.ProvinceId;
            }
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //初始化业务逻辑类和实体类
            RestaurantBll  = new EyouSoft.BLL.SupplierStructure.SupplierRestaurant();
            Restaurantinfo = new EyouSoft.Model.SupplierStructure.SupplierRestaurantInfo();

            //初始化城市和省份
            this.ucProvince1.CompanyId = CurrentUserCompanyID;
            this.ucProvince1.IsFav     = true;
            this.ucCity1.CompanyId     = CurrentUserCompanyID;
            this.ucCity1.IsFav         = true;

            if (!IsPostBack)
            {
                //判断权限
                if (CheckGrant(global::Common.Enum.TravelPermission.供应商管理_餐馆_栏目))
                {
                    type = Utils.GetQueryStringValue("type");
                    switch (type)
                    {
                    case "modify":
                        if (CheckGrant(global::Common.Enum.TravelPermission.供应商管理_餐馆_修改))
                        {
                            bind();
                        }
                        else
                        {
                            Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.供应商管理_餐馆_修改, false);
                        }
                        break;

                    case "show":
                        show = true;
                        bind();

                        break;

                    default:
                        if (!CheckGrant(global::Common.Enum.TravelPermission.供应商管理_餐馆_新增))
                        {
                            Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.供应商管理_餐馆_新增, false);
                        }
                        break;
                    }
                }
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 获取餐馆供应商附加信息(不含供应商基本信息)
        /// </summary>
        /// <param name="supplierId">供应商编号</param>
        /// <returns></returns>
        public EyouSoft.Model.SupplierStructure.SupplierRestaurantInfo GetRestaurantInfo(int supplierId)
        {
            EyouSoft.Model.SupplierStructure.SupplierRestaurantInfo info = null;
            DbCommand cmd = this._db.GetSqlStringCommand(SQL_SELECT_GetRestaurantInfo);

            this._db.AddInParameter(cmd, "SupplierId", DbType.Int32, supplierId);

            using (IDataReader rdr = DbHelper.ExecuteReader(cmd, this._db))
            {
                if (rdr.Read())
                {
                    info = new EyouSoft.Model.SupplierStructure.SupplierRestaurantInfo()
                    {
                        Id        = supplierId,
                        Cuisine   = rdr["Cuisine"].ToString(),
                        Introduce = rdr["Introduce"].ToString(),
                        TourGuide = rdr["TourGuide"].ToString()
                    };
                }
            }

            return(info);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 获取餐馆供应商信息业务实体
        /// </summary>
        /// <param name="supplierId">供应商编号</param>
        /// <returns></returns>
        public EyouSoft.Model.SupplierStructure.SupplierRestaurantInfo GetRestaurantInfo(int supplierId)
        {
            if (supplierId < 1)
            {
                return(null);
            }

            EyouSoft.Model.SupplierStructure.SupplierRestaurantInfo info      = dal.GetRestaurantInfo(supplierId);
            EyouSoft.BLL.CompanyStructure.SupplierBaseHandle        basicbll  = new EyouSoft.BLL.CompanyStructure.SupplierBaseHandle();
            EyouSoft.Model.CompanyStructure.SupplierBasic           basicinfo = basicbll.GetSupplierBase(supplierId);
            basicbll = null;

            if (basicinfo != null && info != null)
            {
                info.CityId          = basicinfo.CityId;
                info.CityName        = basicinfo.CityName;
                info.CompanyId       = basicinfo.CompanyId;
                info.Id              = basicinfo.Id;
                info.IsDelete        = basicinfo.IsDelete;
                info.IssueTime       = basicinfo.IssueTime;
                info.OperatorId      = basicinfo.OperatorId;
                info.ProvinceId      = basicinfo.ProvinceId;
                info.ProvinceName    = basicinfo.ProvinceName;
                info.Remark          = basicinfo.Remark;
                info.SupplierContact = basicinfo.SupplierContact;
                info.SupplierPic     = basicinfo.SupplierPic;
                info.SupplierType    = basicinfo.SupplierType;
                info.TradeNum        = basicinfo.TradeNum;
                info.UnitAddress     = basicinfo.UnitAddress;
                info.UnitName        = basicinfo.UnitName;

                return(info);
            }

            return(null);
        }
Exemplo n.º 9
0
        protected void LinkButton_Click(object sender, EventArgs e)
        {
            //餐馆编号
            int tid = Utils.GetInt(Utils.GetQueryStringValue("tid"));

            if (tid > 0)
            {
                Restaurantinfo    = RestaurantBll.GetRestaurantInfo(tid);
                Restaurantinfo.Id = tid;
            }
            else
            {
                Restaurantinfo.SupplierType = EyouSoft.Model.EnumType.CompanyStructure.SupplierType.餐馆;
            }

            //省份编号
            Restaurantinfo.ProvinceId = this.ucProvince1.ProvinceId;
            EyouSoft.Model.CompanyStructure.Province Provincemodel = new EyouSoft.BLL.CompanyStructure.Province().GetModel(this.ucProvince1.ProvinceId);
            if (Provincemodel != null)
            {
                Restaurantinfo.ProvinceName = Provincemodel.ProvinceName;
            }

            //城市编号
            Restaurantinfo.CityId = this.ucCity1.CityId;
            EyouSoft.Model.CompanyStructure.City citymodel = new EyouSoft.BLL.CompanyStructure.City().GetModel(this.ucCity1.CityId);
            if (citymodel != null)
            {
                Restaurantinfo.CityName = citymodel.CityName;
            }

            //单位名称
            Restaurantinfo.UnitName = Utils.GetFormValue("Txtunitsnname");
            //菜系
            Restaurantinfo.Cuisine = Utils.GetFormValue("TxtCuisine");
            //单位地址
            Restaurantinfo.UnitAddress = Utils.GetFormValue("TxtAddress");
            //餐馆简介
            Restaurantinfo.Introduce = Utils.GetFormValue("ResProfile");
            //导游词
            Restaurantinfo.TourGuide = Utils.GetFormValue("TourGuids");
            //当前公司编号
            Restaurantinfo.CompanyId = this.SiteUserInfo.CompanyID;
            //当前操作员编号
            Restaurantinfo.OperatorId = this.SiteUserInfo.ID;
            //备注
            Restaurantinfo.Remark          = Utils.GetFormValue("TxtRemarks");
            Restaurantinfo.SupplierContact = new List <EyouSoft.Model.CompanyStructure.SupplierContact>();
            Restaurantinfo.IsDelete        = false;
            string[] accmanname   = Utils.GetFormValues("inname");
            string[] accmandate   = Utils.GetFormValues("indate");
            string[] accmanphone  = Utils.GetFormValues("inphone");
            string[] accmanmobile = Utils.GetFormValues("inmobile");
            string[] accmanqq     = Utils.GetFormValues("inqq");
            string[] accmanemail  = Utils.GetFormValues("inemail");
            string[] accmanefax   = Utils.GetFormValues("inefax");
            for (int i = 0; i < accmanname.Length; i++)
            {
                EyouSoft.Model.CompanyStructure.SupplierContact scModel = new EyouSoft.Model.CompanyStructure.SupplierContact();
                scModel.ContactName   = accmanname[i];
                scModel.JobTitle      = accmandate[i];
                scModel.ContactTel    = accmanphone[i];
                scModel.ContactMobile = accmanmobile[i];
                scModel.QQ            = accmanqq[i];
                scModel.Email         = accmanemail[i];
                scModel.ContactFax    = accmanefax[i];
                scModel.CompanyId     = SiteUserInfo.CompanyID;
                scModel.SupplierType  = EyouSoft.Model.EnumType.CompanyStructure.SupplierType.餐馆;
                Restaurantinfo.SupplierContact.Add(scModel);
            }

            int res = 0;

            if (tid > 0)
            {
                //修改餐馆信息
                res = RestaurantBll.UpdateRestaurantInfo(Restaurantinfo);
            }
            else
            {
                //添加保险餐馆信息
                res = RestaurantBll.InsertRestaurantInfo(Restaurantinfo);
            }

            if (res > 0)
            {
                MessageBox.ResponseScript(this, string.Format(";alert('{0}');window.parent.Boxy.getIframeDialog('{1}').hide(); {2}", "保存成功!", Utils.GetQueryStringValue("iframeId"), tid > 0 ? "window.parent.location.reload();" : "window.parent.location.href='/SupplierControl/Restaurants/Restaurantslist.aspx';"));
            }
            else
            {
                MessageBox.ResponseScript(this, ";alert('保存失败!');");
            }
        }