Exemplo n.º 1
0
        public Form_ShopVerison()
        {
            InitializeComponent();


            ShopID = GlobalParams.ShopID;
            if (ShopID < 0)
            {
                MessageBox.Show("您不属于任何店铺,请联系系统管理员分配您的店铺所属!", "错误!", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                this.Close();
            }
            CarSummery_Client = (CarSummeryClient)ClientFactory.GetClient(ClientType.Type.CarSummery);
            Brand_Client      = (BrandClient)ClientFactory.GetClient(ClientType.Type.Brand);
            Type_Client       = (TypeClient)ClientFactory.GetClient(ClientType.Type.Type);
            Version_Client    = (VersionClient)ClientFactory.GetClient(ClientType.Type.Version);

            List_Brand       = Brand_Client.SelectAllBrands().ToList();
            List_Type        = Type_Client.SelectAllTypes().ToList();
            List_VersionInfo = CarSummery_Client.SelectAllCar().ToList();
            Mark             = false;
            LB_VersionBind();
            CB_BrandBind();
            CB_TypeBind();
            BT_UpdateVersion.Visible = false;
        }
Exemplo n.º 2
0
        //
        // GET: /Car/
        /// <summary>
        /// 浏览汽车信息视图
        /// </summary>
        /// <param name="ID">城市编号</param>
        /// <returns></returns>
        public ActionResult Select(int?ID)
        {
            ID = ID ?? 0;
            this.HttpContext.Session["CityID"] = ID;
            //设置车辆浏览模型
            CarSummeryClient     CarSummery_Client = (CarSummeryClient)ClientFactory.GetClient(ClientType.Type.CarSummery);
            List <Car_ViewModel> List_Car          = CarSummery_Client.SelectAllCar().ToList();

            if (ID != 0)
            {
                List_Car = List_Car.Where(P => P.City_ID == ID).ToList();
            }
            CarSummery_Client.Close();
            ViewData["Count"] = List_Car.Count();
            this.HttpContext.Session["Model"] = List_Car;

            //设置店铺
            ShopService.ShopClient      Shop_Client = (ShopService.ShopClient)ClientFactory.GetClient(ClientType.Type.Shop);
            List <ShopService.Car_Shop> List_Shop   = Shop_Client.SelectAllShops().Where(P => P.Shop_City == ID).ToList();

            Shop_Client.Close();
            List_Shop.Insert(0, new ShopService.Car_Shop()
            {
                Shop_ID = 0, Shop_Name = "全部"
            });
            ViewData["ListShop"] = List_Shop;
            this.HttpContext.Session["ShopSelect"] = 0;

            //设置车辆类型
            TypeService.TypeClient      Type_Client = (TypeService.TypeClient)ClientFactory.GetClient(ClientType.Type.Type);
            List <TypeService.Car_Type> List_Type   = Type_Client.SelectAllTypes().ToList();

            Type_Client.Close();
            List_Type.Insert(0, new TypeService.Car_Type()
            {
                Type_ID = 0, Type_Name = "全部"
            });
            ViewData["ListType"] = List_Type;
            this.HttpContext.Session["TypeSelect"] = 0;

            //设置租赁价格
            this.HttpContext.Session["MinPrice"] = 0;
            this.HttpContext.Session["MaxPrice"] = 100000;


            //设置品牌系列
            BrandService.BrandClient      Brand_Client = (BrandService.BrandClient)ClientFactory.GetClient(ClientType.Type.Brand);
            List <BrandService.Car_Brand> List_Brand   = Brand_Client.SelectAllBrands().ToList();

            Brand_Client.Close();
            List_Brand.Insert(0, new BrandService.Car_Brand()
            {
                Brand_ID = 0, Brand_Name = "全部"
            });
            ViewData["ListBrand"] = List_Brand;
            this.HttpContext.Session["BrandSelect"] = 0;

            return(View(List_Car));
        }
Exemplo n.º 3
0
        public ActionResult OrderGet(int CityID, int ShopID, int?VersionID)
        {
            ViewData["CityID"] = CityID;
            ViewData["ShopID"] = ShopID;
            VersionID          = VersionID ?? 1;

            //判断是否登录
            if (Session["UserName"] == null)
            {
                return(View("OrderPart", new OrderViewModel()));
            }
            else
            {
                //当之前没有选择店铺时,现在列出店铺列表提供选择
                CarSummeryClient     CarSummery_Client = (CarSummeryClient)ClientFactory.GetClient(ClientType.Type.CarSummery);
                List <Car_ViewModel> List_Car          = CarSummery_Client.SelectAllCar().ToList();
                List_Car = List_Car.Where(P => P.City_ID == CityID && P.Version_ID == VersionID).ToList();
                CarSummery_Client.Close();
                if (ShopID == 0)
                {
                    List <SelectListItem> ShopList = new List <SelectListItem>();
                    foreach (Car_ViewModel temp in List_Car)
                    {
                        SelectListItem SL = new SelectListItem();
                        SL.Text  = temp.Shop_Name;
                        SL.Value = temp.Shop_ID.ToString();
                        if (!ShopList.Contains(SL))
                        {
                            ShopList.Add(SL);
                        }
                    }
                    ViewData["ShopList"] = ShopList;
                }
                //添加活动事件选项表
                ActionClient      Action_Client = (ActionClient)ClientFactory.GetClient(ClientType.Type.Action);
                List <Car_Action> ActionList    = Action_Client.SelectAllActions().ToList();
                Action_Client.Close();
                List <SelectListItem> ListAction = new List <SelectListItem>();
                foreach (Car_Action Temp in ActionList)
                {
                    SelectListItem sl = new SelectListItem();
                    sl.Text  = Temp.Action_Name;
                    sl.Value = Temp.Action_ID.ToString();
                    ListAction.Add(sl);
                }
                ViewData["ActionList"] = ListAction;

                return(View("OrderPart", new OrderViewModel()
                {
                    VersionID = (int)VersionID,
                    StartTime = DateTime.Now.Date.ToString(),
                    EndTime = DateTime.Now.Date.ToString()
                }));
            }
        }
Exemplo n.º 4
0
        public Form_VersionInfo(int ShopID, int VersionID, string[] starttime, string[] endtime)
        {
            InitializeComponent();
            CarSummery_Client   = (CarSummeryClient)ClientFactory.GetClient(ClientType.Type.CarSummery);
            OrderSummery_Client = (OrderSummeryClient)ClientFactory.GetClient(ClientType.Type.OrderSummery);
            Car_ViewModel SelectCar    = CarSummery_Client.SelectAllCar().Where(P => P.Version_ID == VersionID).Single();
            int           Versiontotal = SelectCar.Version_Count;

            int Car_Count = OrderSummery_Client.SelectRentaledCarCount_TimeAndVersion(
                ShopID, VersionID,
                Convert.ToInt32(starttime[0]),
                Convert.ToInt32(starttime[1]),
                Convert.ToInt32(starttime[2]),
                Convert.ToInt32(endtime[0]),
                Convert.ToInt32(endtime[1]),
                Convert.ToInt32(endtime[2])
                );
            int nokosite = Versiontotal - Car_Count;

            Label_BaseKM.Text            = SelectCar.Version_BaseKM.ToString();
            Label_Brand.Text             = SelectCar.Brand_Name.ToString();
            Label_Count.Text             = nokosite.ToString();
            Label_Info.Text              = SelectCar.Version_Info;
            Label_Person.Text            = SelectCar.Version_Person.ToString();
            Label_PriceDeposit.Text      = SelectCar.Version_Price_Deposit.ToString();
            Label_PriceMemberCatch.Text  = SelectCar.Version_Price_Member_Catch.ToString();
            Label_PriceMemberRental.Text = SelectCar.Version_Price_Member_Rental.ToString();
            Label_PriceNormalCatch.Text  = SelectCar.Version_Price_Normal_Catch.ToString();
            Label_PriceNormalRental.Text = SelectCar.Version_Price_Normal_Rental.ToString();
            Label_PriceOver.Text         = SelectCar.Version_Price_Over.ToString();
            Label_PriceOverRiding.Text   = SelectCar.Version_Price_Over_Riding.ToString();
            Label_PriceRiding.Text       = SelectCar.Version_Price_Riding.ToString();
            Label_Type.Text              = SelectCar.Type_Name;
            Label_Version.Text           = SelectCar.Version_Name;
            try
            {
                string[] imgArr = SelectCar.Version_IMG.ToString().Split(new char[] { ',' });

                byte[] bty = Array.ConvertAll <string, byte>(imgArr, delegate(string s) { return(byte.Parse(s)); });

                Bitmap bmp = new Bitmap(bty.FromBytes(520, null));
                PB_Pic.Image = bmp;
            }
            catch
            {
                MessageBox.Show("载入图片出现错误,请重新上传图片更新数据库或联系管理员!", "错误!!", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
Exemplo n.º 5
0
        public String  RentalNumberGet(int ShopID, int VersionID, String StartTime, String EndTime)
        {
            String[] starttime = StartTime.Split('/');
            String[] endtime   = EndTime.Split('/');

            //得到所选择的车的所有存在数量
            CarSummeryClient     CarSummery_Client = (CarSummeryClient)ClientFactory.GetClient(ClientType.Type.CarSummery);
            List <Car_ViewModel> List_Car          = CarSummery_Client.SelectAllCar().ToList();

            List_Car = List_Car.Where(P => P.Shop_ID == ShopID && P.Version_ID == VersionID).ToList();
            int Car_Total = List_Car.FirstOrDefault().Version_Count;

            CarSummery_Client.Close();

            //得到所选择的车的已预订数量
            List <SelectListItem> CarCountList = new List <SelectListItem>();

            OrderSummeryService.OrderSummeryClient OrderSummery_Client = (OrderSummeryService.OrderSummeryClient)ClientFactory.GetClient(ClientType.Type.OrderSummery);
            int Car_Count = OrderSummery_Client.SelectRentaledCarCount_TimeAndVersion(
                ShopID, (int)VersionID,
                Convert.ToInt32(starttime[0]),
                Convert.ToInt32(starttime[1]),
                Convert.ToInt32(starttime[2]),
                Convert.ToInt32(endtime[0]),
                Convert.ToInt32(endtime[1]),
                Convert.ToInt32(endtime[2])
                );
            StringWriter   SW     = new StringWriter();
            HtmlTextWriter writer = new HtmlTextWriter(SW);

            writer.AddAttribute("name", "RentalNumber");
            writer.AddAttribute("class", "TextBox");
            writer.AddAttribute("Stype", "height:20px;");
            writer.RenderBeginTag(HtmlTextWriterTag.Select);
            for (int i = 1; i <= Car_Total - Car_Count; i++)
            {
                writer.AddAttribute("label", i.ToString());
                writer.AddAttribute("value", i.ToString());
                writer.RenderBeginTag(HtmlTextWriterTag.Option);
                writer.Write(i.ToString());
                writer.RenderEndTag();
            }

            writer.RenderEndTag();
            return(SW.ToString());
        }
Exemplo n.º 6
0
        public ActionResult SelectInfo(int CityID, int ShopID, int VersionID)
        {
            Car_ViewModel CarInfo;

            ViewData["CityID"]    = CityID;
            ViewData["ShopID"]    = ShopID;
            ViewData["VersionID"] = VersionID;
            CarSummeryClient CarSummery_Client = (CarSummeryClient)ClientFactory.GetClient(ClientType.Type.CarSummery);

            CarInfo = CarSummery_Client.SelectAllCar().Where(P => P.Version_ID == VersionID).FirstOrDefault();
            CarSummery_Client.Close();
            if (Session["UserName"] == null)
            {
                Session["BackUrl"] = Request.Url.AbsoluteUri;
            }
            return(View(CarInfo));
        }
Exemplo n.º 7
0
 public Form_VersionManage()
 {
     InitializeComponent();
     Mark = false;
     CarSummery_Client = (CarSummeryClient)ClientFactory.GetClient(ClientType.Type.CarSummery);
     Province_Client   = (ProvinceClient)ClientFactory.GetClient(ClientType.Type.Province);
     City_Client       = (CityClient)ClientFactory.GetClient(ClientType.Type.City);
     Shop_Client       = (ShopClient)ClientFactory.GetClient(ClientType.Type.Shop);
     Brand_Client      = (BrandClient)ClientFactory.GetClient(ClientType.Type.Brand);
     Type_Client       = (TypeClient)ClientFactory.GetClient(ClientType.Type.Type);
     Version_Client    = (VersionClient)ClientFactory.GetClient(ClientType.Type.Version);
     List_VersionInfo  = CarSummery_Client.SelectAllCar().ToList();
     List_Car_Province = Province_Client.SelectAllProvinces().ToList();
     List_City         = City_Client.SelectAllCitys().ToList();
     List_Shop         = Shop_Client.SelectAllShops().ToList();
     List_Brand        = Brand_Client.SelectAllBrands().ToList();
     List_Type         = Type_Client.SelectAllTypes().ToList();
     CB_ProviceBind();
     CB_BrandBind();
     CB_TypeBind();
     BT_UpdateVersion.Visible = false;
 }
Exemplo n.º 8
0
        /// <summary>
        /// 客户端服务实例产生器
        /// </summary>
        /// <param name="type">产生的服务类型</param>
        /// <returns></returns>
        private static object build(ClientType.Type type)
        {
            switch (type)
            {
            case ClientType.Type.Account:
            {
                AccountClient temp = new AccountClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <AccountClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.Action:
            {
                ActionClient temp = new ActionClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <ActionClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.Brand:
            {
                BrandClient temp = new BrandClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <BrandClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.CarSummery:
            {
                CarSummeryClient temp = new CarSummeryClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <CarSummeryClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.Checkout:
            {
                CheckoutClient temp = new CheckoutClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <CheckoutClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.City:
            {
                CityClient temp = new CityClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <CityClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.Order:
            {
                OrderClient temp = new OrderClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <OrderClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.OrderSummery:
            {
                OrderSummeryClient temp = new OrderSummeryClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <OrderSummeryClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.Province:
            {
                ProvinceClient temp = new ProvinceClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <ProvinceClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.RAP:
            {
                RAPClient temp = new RAPClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <RAPClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.Salary:
            {
                SalaryClient temp = new SalaryClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <SalaryClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.SalaryAppend:
            {
                SalaryAppendClient temp = new SalaryAppendClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <SalaryAppendClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.SalaryInfoSummery:
            {
                SalaryInfoSummeryClient          temp  = new SalaryInfoSummeryClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <SalaryInfoSummeryClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.SalaryLog:
            {
                SalaryLogClient temp = new SalaryLogClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <SalaryLogClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.Shop:
            {
                ShopClient temp = new ShopClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <ShopClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.Type:
            {
                TypeClient temp = new TypeClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <TypeClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.Version:
            {
                VersionClient temp = new VersionClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <VersionClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.WorkRAP:
            {
                WorkRAPClient temp = new WorkRAPClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <WorkRAPClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.UserManager:
            {
                UserManagerClient temp = new UserManagerClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <UserManagerClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.UserSummery:
            {
                UserSummeryClient temp = new UserSummeryClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <UserSummeryClient>(type, temp);
                return(temp);
            }

            case ClientType.Type.GetCar:
            {
                GetCarClient temp = new GetCarClient();
                UserNamePasswordClientCredential UNPCC = temp.ClientCredentials.UserName;
                UNPCC.UserName = GlobalParams.UserName;
                UNPCC.Password = GlobalParams.Password;
                AddClient <GetCarClient>(type, temp);
                return(temp);
            }
            }
            ;
            return(null);
        }