Exemple #1
0
        public string GetOrder()
        {
            searchBLL search = (searchBLL)Session["search"];
            DateTime  from   = DateTime.Parse(search.PickupDate);
            DateTime  ret    = DateTime.Parse(search.ReturnDate);
            double    tot    = (ret - from).TotalDays;

            return(tot.ToString());
        }
Exemple #2
0
        public static searchBLL getSearchById(int id)
        {
            string    sql    = "select * from SearchTable where id = " + id;
            DataBase  db     = new DataBase();
            DataTable dt     = db.ExecuteReader(sql);
            searchBLL search = new searchBLL(dt.Rows[0]["FromLocation"].ToString(), dt.Rows[0]["FromDate"].ToString(), dt.Rows[0]["ToLocation"].ToString(), dt.Rows[0]["ToDate"].ToString());

            return(search);
        }
Exemple #3
0
        //מתודה שרצה כאשר המשתמש הקליק על כפתור ערוך הזמנה
        //המתודה מעבירה את המשתמש לדף עריכת הזמנה עבור ההזמנה הספציפית
        protected void RptOrders_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int    orderIndex = e.Item.ItemIndex;
            person person     = new person();

            person = (person)Session["person"];
            List <order> orders = GlobFuncs.getOrdersByCustomerId(person.CustomId);
            searchBLL    search = new searchBLL(orders[orderIndex].PickupBranch.ToString(), orders[orderIndex].PickupDate.Substring(6, 4) + "-" + orders[orderIndex].PickupDate.Substring(3, 2) + "-" + orders[orderIndex].PickupDate.Substring(0, 2), orders[orderIndex].ReturnBranch.ToString(), orders[orderIndex].ReturnDate.Substring(6, 4) + "-" + orders[orderIndex].ReturnDate.Substring(3, 2) + "-" + orders[orderIndex].ReturnDate.Substring(0, 2));

            Session["search"] = search;
            Response.Redirect("Order.aspx?Comapny=" + GlobFuncs.getComanyIdByName(orders[orderIndex].CompanyId) + "&CarId=" + orders[orderIndex].CarId + "&id=" + int.Parse(orders[orderIndex].RentId.ToString()) * 1825.8976);
        }
Exemple #4
0
        protected void getJson()
        {
            searchBLL search = (searchBLL)Session["search"];
            string    id     = Request["search"];

            if (id != null)
            {
                search = GlobFuncs.getSearchById(int.Parse(id));
            }
            if (search == null)
            {
                Response.Redirect("search.aspx");
            }
            if (search.PickupDate.Contains("/"))
            {
                search.PickupDate = search.PickupDate.Substring(0, 10);
                search.ReturnDate = search.ReturnDate.Substring(0, 10);
                string pickdate = search.PickupDate.Substring(6, 4);
                string retdate  = search.ReturnDate.Substring(6, 4);
                pickdate          = pickdate + "-";
                retdate           = retdate + "-";
                pickdate          = pickdate + search.PickupDate.Substring(0, 2);
                retdate           = retdate + search.ReturnDate.Substring(0, 2);
                pickdate          = pickdate + "-";
                retdate           = retdate + "-";
                pickdate          = pickdate + search.PickupDate.Substring(3, 2);
                retdate           = retdate + search.ReturnDate.Substring(3, 2);
                search.PickupDate = pickdate;
                search.ReturnDate = retdate;
            }
            string ret = search.GetList();

            LtlMsg.Text = "<script>var cars=JSON.parse(" + ret + ")\n var companys = " + GlobFuncs.GetCompanyList() + "</script>";
            DdlPickupLocation.DataSource     = GlobFuncs.GetDDL("CityTable", "CityId", "CityName");
            DdlPickupLocation.DataTextField  = "name";
            DdlPickupLocation.DataValueField = "id";
            DdlPickupLocation.DataBind();
            DdlPickupLocation.SelectedValue  = search.PickupLocation;
            DdlReturnLocation.DataSource     = GlobFuncs.GetDDL("CityTable", "CityId", "CityName");
            DdlReturnLocation.DataTextField  = "name";
            DdlReturnLocation.DataValueField = "id";
            DdlReturnLocation.DataBind();
            DdlReturnLocation.SelectedValue = search.ReturnLocarion;
            string date = search.PickupDate + " - " + search.ReturnDate;

            ReturnDate.Text = date.Substring(5, 2) + "/" + date.Substring(8, 2) + "/" + date.Substring(0, 4) + " - " + date.Substring(18, 2) + "/" + date.Substring(21, 2) + "/" + date.Substring(13, 4);
            if (ret.Length < 20)
            {
                showErrorMwssage(2009);
            }
        }
Exemple #5
0
 public OrderDAL(int company, int totalPrice, int pickupBranch, int returnBranch, DateTime pickupDate, DateTime returnDate, int carId, List <Extention> extetions, searchBLL search, person person, creaditCardBLL creaditCard, string notes)
 {
     Company         = company;
     this.totalPrice = totalPrice;
     PickupBranch    = pickupBranch;
     ReturnBranch    = returnBranch;
     PickupDate      = GetDate(pickupDate);
     ReturnDate      = GetDate(returnDate);
     CarId           = carId;
     this.extetions  = extetions;
     Search          = search;
     this.person     = person;
     this.CreditCard = creaditCard;
     this.notes      = notes;
 }
Exemple #6
0
        public editOrderBll(int company, int totalPrice, int pickupBranch, int returnBranch, DateTime pickupDate, DateTime returnDate, int carId, List <Extention> extetions, searchBLL search, person person, creaditCardBLL creaditCard, string orderId, string notes) : base(company, totalPrice, pickupBranch, returnBranch, pickupDate, returnDate, carId, extetions, search, person, creaditCard, notes)
        {
            Company         = company;
            this.totalPrice = totalPrice;
            PickupBranch    = pickupBranch;
            ReturnBranch    = returnBranch;
            PickupDate      = pickupDate;
            ReturnDate      = returnDate;
            CarId           = carId;

            this.extetions   = extetions;
            Search           = search;
            this.person      = person;
            this.creaditCard = creaditCard;
            this.orderId     = orderId;
            this.externalId  = getExtIdByOrderId(orderId);
            this.notes       = notes;
        }
Exemple #7
0
 public void CreateSearch()
 {
     if (DdlPickupLocation.SelectedValue == "-1")
     {
         showErrorMwssage(2006);
     }
     else if (DdlReturnLocation.SelectedValue == "-1")
     {
         showErrorMwssage(2007);
     }
     else if (ReturnDate.Text.Length <= 10)
     {
         showErrorMwssage(2008);
     }
     else
     {
         Session["search"] = new searchBLL(DdlPickupLocation.Text.ToString(), ReturnDate.Text.ToString().Substring(0, 10), DdlReturnLocation.Text.ToString(), ReturnDate.Text.ToString().Substring(13));
     }
 }
Exemple #8
0
 protected void BtnSearch_Click(object sender, EventArgs e)
 {
     if (DdlPickupLocation.SelectedValue == "-1")
     {
         showErrorMwssage(2006);
     }
     else if (DdlReturnLocation.SelectedValue == "-1")
     {
         showErrorMwssage(2007);
     }
     else if (ReturnDate.Text.Length <= 10)
     {
         showErrorMwssage(2008);
     }
     else
     {
         person per = new person();
         Session["search"] = new searchBLL(DdlPickupLocation.Text.ToString(), ReturnDate.Text.ToString().Substring(0, 10), DdlReturnLocation.Text.ToString(), ReturnDate.Text.ToString().Substring(13));
         Response.Redirect("results.aspx");
     }
 }
Exemple #9
0
 public editOrderDal(int orderId, int externalOrderId, int company, int totalPrice, int pickupBranch, int returnBranch, DateTime pickupDate, DateTime returnDate, int carId, List <Extention> extetions, searchBLL search, person person, creaditCardBLL creaditCard, string notes) : base(company, totalPrice, pickupBranch, returnBranch, pickupDate, returnDate, carId, extetions, search, person, creaditCard, notes)
 {
     this.orderId         = orderId;
     this.externalOrderId = externalOrderId;
 }
Exemple #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Company      = Request["Company"];
         Car          = Request["CarId"];
         creditCardId = Request["card"];
         if (Car == null || Company == null || creditCardId == null || Session["search"] == null || Session["selectedExt"] == null || Session["person"] == null)
         {
             Response.Redirect("search.aspx");
         }
         person           person     = (person)Session["person"];
         searchBLL        search     = (searchBLL)Session["search"];
         List <Extention> extention  = new List <Extention>();
         carDAL           carDAL     = new carDAL(Company, int.Parse(Car));
         CarDetails       carDetails = new CarDetails();
         creaditCardBLL   creditCard = new creaditCardBLL();
         creditCard.getCardDetails(creditCardId);
         string[] arr = carDAL.GetDetails().Split('#');
         string   str = arr[0].Substring(2, arr[0].Length - 3).Replace("\\", "");
         carDetails = JsonConvert.DeserializeObject <CarDetails>(str);
         extention  = GlobFuncs.convertExtensionToList(Session["selectedExt"].ToString());
         int      totalPrice = int.Parse(Session["totPrice"].ToString());
         double   orderId;
         OrderBLL order = new OrderBLL(int.Parse(Company), totalPrice, int.Parse(search.PickupLocation), int.Parse(search.ReturnLocarion), DateTime.Parse(search.PickupDate), DateTime.Parse(search.ReturnDate), int.Parse(Car), extention, search, person, creditCard, Session["notes"].ToString());
         if (Request["id"] == null)
         {
             List <string> OrderId = order.CreateOrder();
             string        o       = "";
             int           num     = 1;
             foreach (string i in OrderId)
             {
                 o += "var a" + num + " = " + i + ";";
                 num++;
             }
             Order.Text = "<script>var or = " + JsonConvert.SerializeObject(order) + "\n var car = JSON.parse(" + arr[0] + "\") \n var companys = " + Application["Companys"] + "\n " + o + "</script>";
             GlobFuncs.SendEmail(person.Email, "אישןר ביצוע הזמנה מס' " + OrderId[1], "");
             sendMessages(person.CustomId, OrderId[1], person.FullName);
             LtlOrdId.Text = OrderId[0];
         }
         else
         {
             double o = double.Parse(Request["id"]);
             orderId = o / 1825.8976;
             editOrderBll editOrder = new editOrderBll(int.Parse(Company), totalPrice, int.Parse(search.PickupLocation), int.Parse(search.ReturnLocarion), DateTime.Parse(search.PickupDate), DateTime.Parse(search.ReturnDate), int.Parse(Car), extention, search, person, creditCard, orderId.ToString(), Session["notes"].ToString());
             int          retOrder  = editOrder.editOrder();
             LtlOrdId.Text = orderId.ToString();
             Order.Text    = "<script> var or = " + JsonConvert.SerializeObject(order) + "\n var car = JSON.parse(" + arr[0] + "\") \n var companys = " + Application["Companys"] + "\n var a1 = " + orderId + "\n var a2 = " + GlobFuncs.getExtenalOrderIdByOrderId(int.Parse(orderId.ToString())) + "</script>";
             LtlOrdId.Text = orderId.ToString();
         }
         DataTable dtAdr = new DataTable();
         dtAdr                  = GlobFuncs.GetFullAddress(person.CustomId);
         LtlName.Text           = person.FullName;
         LtlPhone.Text          = person.PhoneNumber;
         LtlEmail.Text          = person.Email;
         LtlAddress.Text        = dtAdr.Rows[0]["Address"] + " " + dtAdr.Rows[0]["CityName"].ToString();
         Session["search"]      = null;
         Session["orderQuery"]  = null;
         Session["selectedExt"] = null;
         if (Request["id"] != null)
         {
             Response.Redirect("PrivateArea.aspx");
         }
     }
 }