コード例 #1
0
        public void BindNew(int newid)
        {
            try
            {
                using (ZLzuche.Model.ZLzucheEntities entity = new Model.ZLzucheEntities())
                {
                    var newmodel = entity.News.Where(x => x.Id == newid).FirstOrDefault();
                    if (newmodel == null)
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('该新闻不存在');</script>");
                        return;
                    }
                    else
                    {
                        this.labTitle.InnerHtml = newmodel.Subject;
                        this.buildTime.InnerHtml = "发表时间:" + newmodel.CreateTime.ToString();
                        this.divContent.InnerHtml = newmodel.Content;
                    }
                }
            }
            catch (Exception ex)
            {

            }
        }
コード例 #2
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnNew_Click(object sender, EventArgs e)
        {
            string enterpriseName = this.EnterpriseName.Text.Trim();
            string linkman = this.Linkman.Text.Trim();
            string linktel = this.LinkTel.Text.Trim();
            string email = this.Email.Text.Trim();
            string needinfo = this.NeedInfo.Text.Trim();
            try
            {
                using (ZLzuche.Model.ZLzucheEntities entity = new Model.ZLzucheEntities())
                {
                    ZLzuche.Model.rzzlApply model = new Model.rzzlApply();
                    model.EnterpriseName = enterpriseName;
                    model.Linkman = linkman;
                    model.LinkTel = linktel;
                    model.Email = email;
                    model.NeedInfo = needinfo;
                    model.ApplyTime = DateTime.Now;
                    entity.AddTorzzlApply(model);
                    entity.SaveChanges();

                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('申请成功');window.close();</script>");
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('新增失败');</script>");
                return;
            }
        }
コード例 #3
0
 private void BindFocusImages()
 {
     using (var db = new ZLzucheEntities())
     {
         var focusImageList = db.FocusImage.OrderByDescending(model => model.CreateTime).Take(4);
         repFocusImage.DataSource = focusImageList;
         repFocusImage.DataBind();
     }
 }
コード例 #4
0
 private void BindData()
 {
     using (var db = new ZLzucheEntities())
     {
         //短租(取车城市)
         var takeCityList = db.Shop.OrderBy(model => model.City).Select(model => new { City = model.City }).Distinct();
         ddlShortRentTakeCity.DataSource = takeCityList;
         ddlShortRentTakeCity.DataBind();
         if (takeCityList.Count() == 1)
         {
             ddlShortRentTakeCity.SelectedIndex = 1;
             txtLongRentTakeCity.Visible = ddlShortRentTakeCity.Visible = false;
             var item = takeCityList.ToList()[0];
             lblShortRentTakeCity.Text = item.City;
             txtLongRentTakeCity.Text = lblLongRentTakeCity.Text = item.City;
         }
     }
 }
コード例 #5
0
 private void BindTakeStore()
 {
     using (var db = new ZLzucheEntities())
     {
         //(还车门店)
         var takeStoreList = db.Shop.OrderBy(model =>model.Name).Select(model => new { Name = model.Name }).Distinct();
         ddlTakeStore.DataSource = takeStoreList;
         ddlTakeStore.DataBind();
         ddlTakeStore.Items.Insert(0, new ListItem("--请选择--",""));
         if (takeStoreList.Count() == 1)
         {
             ddlTakeStore.SelectedIndex = 1;
             ddlTakeStore.Visible = false;
             var item = takeStoreList.ToList()[0];
             lblTakeStore.Text = item.Name;
             cbIsEqualStore.Checked = true;
             cbIsEqualStore.Visible = false;
         }
     }
 }
コード例 #6
0
 protected void lbnSubmitOrder_Click(object sender, EventArgs e)
 {
     using (var db = new ZLzucheEntities())
     {
         var orders = new Orders
             {
                 CustomerID = CustomerHelper.CustomerId,
                 OrderType = "短租",
                 GetCarTime = Convert.ToDateTime(txtTakeTime.Text),
                 ReturnCarTime = Convert.ToDateTime(txtReturnTime.Text),
                 HireDays = Convert.ToString((Convert.ToDateTime(txtReturnTime.Text) - Convert.ToDateTime(txtTakeTime.Text)).Days),
                 CreateTime = DateTime.Now
             };
         var carId = string.IsNullOrEmpty(hfCarId.Value) ? 0 : Convert.ToInt32(hfCarId.Value);
         if (carId > 0)
         {
             var car = db.Car.SingleOrDefault(model => model.ID == carId);
             var orderDetails = new OrderDetails
                 {
                     Orders = orders,
                     CarId = car.ID,
                     Price = car.Price,
                     CarNum = 1,
                     Status = 0,
                     CreateBy = CustomerHelper.CustomerId,
                     CreateTime = DateTime.Now
                 };
             orders.OrderDetails.Add(orderDetails);
         }
         db.Orders.AddObject(orders);
         db.SaveChanges();
         ScriptHelper.Alert(this,"短租订单提交成功");
         var gotoUrl = this.ResolveUrl("ShortRent.aspx");
         ScriptHelper.Goto(this,gotoUrl);
     }
 }
コード例 #7
0
        private void SwitchStep4()
        {
            using (var db = new ZLzucheEntities())
            {
                var carId = string.IsNullOrEmpty(hfCarId.Value) ? 0 : Convert.ToInt32(hfCarId.Value);
                var car = db.Car.FirstOrDefault(model => model.ID == carId);
                lblCarInfo4.Text = (car == null) ? "" : string.Format("{0}/{1}", car.CarName, car.CarModel);

                lblMemberName4.Text = UserHelper.CurrentUserName();
                lbltakeTime4.Text = txtTakeTime.Text;
                lblReturnTime4.Text = txtReturnTime.Text;

                var timespan = Convert.ToDateTime(lblReturnTime4.Text) - Convert.ToDateTime(lbltakeTime4.Text);
                var days = timespan.Days;
                lblTakeDays4.Text = lblRentCycleDays4.Text = Convert.ToString(days);
                lblTotalRentMoney4.Text = car == null ? "0" : Convert.ToString(car.Price * days);
                lblInsureMoney.Text = car == null ? "0" : Convert.ToString(40 * days);

                lblTotalMoney4.Text = Convert.ToString(Convert.ToDecimal(lblTotalRentMoney4.Text) + Convert.ToDecimal(lblInsureMoney.Text));
            }
        }
コード例 #8
0
        protected void lbnNext2_Click(object sender, EventArgs e)
        {
            this.CurrentNavIndex = 2;
            divStep01.Visible = false;
            divStep02.Visible = true;
            divCarInfo.Visible = true;
            divOrderInfo.Visible = true;
            divClientLinkInfo.Visible = true;
            divClient.Visible = false;
            divQuotationList.Visible = false;

            using (var db = new ZLzucheEntities())
            {
                var carId = string.IsNullOrEmpty(CarName.Text) ? 0 : Convert.ToInt32(CarName.Text);
                var car = db.Car.SingleOrDefault(model => model.ID ==carId);
                if (car != null)
                {

                    ltlCarName.Text =car.CarType.CarTypeName + car.CarName + car.CarModel;
                    ltlDerailleur.Text = car.Derailleur;
                    ltlCarAge.Text = car.CarAge.ToString();
                    ltlRentCost.Text = String.Format("{0:N0}元",car.MonthPrice);
                }
            }
            ltlTakeCity2.Text = lblShortRentTakeCity.Text;
            ltlTakeTime2.Text = GetCarTime.Text;
            ltlRentCycle.Text = ddlRentCycle.SelectedItem.Text;
            ltlTrank2.Text = CarTypeId.SelectedItem.Text;
            ltlCar2.Text = CarName.SelectedItem.Text;
        }
コード例 #9
0
 protected void lbnSubmit_Click(object sender, EventArgs e)
 {
     using (var db = new ZLzucheEntities())
     {
         var orders = new Orders
         {
             CustomerID = CustomerHelper.CustomerId,
             OrderType = "长租",
             GetCarTime = Convert.ToDateTime(GetCarTime.Text),
             RentMonth =Convert.ToInt32(ddlRentCycle.Text),
             LinkMan = txtLinkMan.Text,
             Phone =  txtPhone.Text,
             CompanyName = txtCompanyName.Text,
             Email =  txtEmail.Text,
             CreateTime = DateTime.Now
         };
         var carId = string.IsNullOrEmpty(CarName.Text) ? 0 : Convert.ToInt32(CarName.Text);
         if (carId > 0)
         {
             var car = db.Car.SingleOrDefault(model => model.ID == carId);
             var orderDetails = new OrderDetails
             {
                 Orders = orders,
                 CarId = car.ID,
                 Price = car.MonthPrice,
                 CarNum = Convert.ToInt32(txtRentNum.Text),
                 Status = 0,
                 CreateBy = CustomerHelper.CustomerId,
                 CreateTime = DateTime.Now
             };
             orders.OrderDetails.Add(orderDetails);
         }
         db.Orders.AddObject(orders);
         db.SaveChanges();
         ScriptHelper.Alert(this, "长租订单提交成功");
         var gotoUrl = this.ResolveUrl("~/LongRent.aspx");
         ScriptHelper.Goto(this, gotoUrl);
     }
 }
コード例 #10
0
        protected void lbnNext3_Click(object sender, EventArgs e)
        {
            CurrentNavIndex = 4;
            divStep01.Visible = false;
            divStep02.Visible = true;
            divClientLinkInfo.Visible = false;
            divCarInfo.Visible = false;
            divOrderInfo.Visible = false;
            divClient.Visible = true;
            divQuotationList.Visible = true;

            ltlLinkMan.Text = txtLinkMan.Text;
            ltlPhone.Text = txtPhone.Text;
            ltlCompanyName.Text = txtCompanyName.Text;
            ltlEmail.Text = txtEmail.Text;

            using (var db = new ZLzucheEntities())
            {
                var carId = string.IsNullOrEmpty(CarName.Text) ? 0 : Convert.ToInt32(CarName.Text);
                var car = db.Car.SingleOrDefault(model => model.ID == carId);
                if (car != null)
                {
                    var imageUrl = string.Format("~/images/CarImage/{0}.jpg", car.ID);
                    imgCar.ImageUrl = this.ResolveUrl( imageUrl);
                    ltlCarType3.Text = car.CarType.CarTypeName;
                    ltlCar3.Text = car.CarName;
                    ltlCarAge3.Text = car.CarAge.ToString();
                    ltlSingleCarRentCost3.Text = String.Format("{0:N0}元", car.MonthPrice);
                    ltlMonthCost.Text = string.Format("{0:N0}元", Convert.ToInt32(ddlRentCycle.Text)*car.MonthPrice);
                    ltlBaseMonthRentCost.Text = string.Format("{0:N0}元/月", car.MonthPrice);
                    ltlCarRentCycle3.Text = ddlRentCycle.SelectedItem.Text;
                    ltlCarRentNum.Text = txtRentNum.Text + "台";
                    ltlTotalRentCost.Text = String.Format("{0:N0}元",
                                                          Convert.ToInt32(ddlRentCycle.Text) * car.MonthPrice *
                                                          Convert.ToDecimal(txtRentNum.Text));
                    ;
                }
            }
        }