예제 #1
0
    protected void ShowOrder_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int rowNumber = Convert.ToInt32(e.CommandArgument);
        int orderId   = Convert.ToInt32(ShowOrder.Rows[rowNumber].Cells[0].Text);

        Pharmcy.PharmcyWS webser = new Pharmcy.PharmcyWS();
        if (e.CommandName == "SeeDetails")
        {
            DataSet ds = webser.GetDetailsAboutOrder(orderId);
            ShowDetails.Visible    = true;
            ShowDetails.DataSource = ds;
            ShowDetails.DataBind();
            for (int i = 0; i < ShowOrder.Rows.Count; i++)
            {
                ShowOrder.Rows[i].Font.Bold = false;
            }
            ShowOrder.Rows[rowNumber].Font.Bold = true;
        }
        if (e.CommandName == "DeleteOrder")
        {
            DateTime orderDate = Convert.ToDateTime(ShowOrder.Rows[rowNumber].Cells[2].ToString());
            if (orderDate.AddDays(2) < DateTime.Now)
            {
                webser.DeleteOrder(orderId);
                SortDDL_SelectedIndexChanged(sender, e);
            }
            else
            {
                Response.Write("<script>alert('לא ניתן לבטל את ההזמנה')</script>");
            }
        }
    }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Doctor d = (Doctor)Session["doctor"];
            HelloLabel.Text = d.CDoctorName;
            Pharmcy.PharmcyWS webser = new Pharmcy.PharmcyWS();
            DataSet           ds     = webser.GetMedinceNameAndId();
            List <ListItem>   LI     = GetAllData.getListItemsForDDL(ds, "Medicine");
            foreach (ListItem l in LI)
            {
                MedicineNameDDL.Items.Add(l);
            }
            MedicineNameDDL.DataBind();

            UserService us = new UserService();
            ds = us.GetUserNameAndId();
            LI = GetAllData.getListItemsForDDL(ds, "User");
            foreach (ListItem l in LI)
            {
                UserNameDDL.Items.Add(l);
            }
            UserNameDDL.DataBind();
        }
    }
예제 #3
0
 protected void ShowShoppingbag_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "DeleteMedicineFromShoppingBag")
     {
         ShoppingBag       sb        = (ShoppingBag)Session["myShoppingBag"];
         int               rowNumber = Convert.ToInt32(e.CommandArgument);
         MedicineInBag     MIB       = new MedicineInBag();
         Pharmcy.PharmcyWS webser    = new Pharmcy.PharmcyWS();
         MIB.CMedicineId = ShowShoppingbag.Rows[rowNumber].Cells[0].Text;
         MIB.CMedicineNeedPrescription = webser.GetMedicineNeedPres(Convert.ToInt32(MIB.CMedicineId));
         if (MIB.CMedicineNeedPrescription)
         {
             List <DataSet> presList = (List <DataSet>)Session["presList"];
             foreach (DataSet d in presList)
             {
                 if (d.Tables[0].Rows[0]["PrescriptionMedicineId"].ToString() == MIB.CMedicineId)
                 {
                     presList.Remove(d);
                     Session["presList"] = presList;
                     break;
                 }
             }
         }
         sb.DeleteMedicineFromList(MIB);
         Session["myShoppingBag"] = sb;
         Response.Write("<script>alert('המוצר נמחק בהצלחה')</script>");
         showShoppingBag(sb);
     }
 }
예제 #4
0
    protected void ShowOrder_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int rowNumber = Convert.ToInt32(e.CommandArgument);
        int orderId   = Convert.ToInt32(ShowOrder.Rows[rowNumber].Cells[0].Text);

        Pharmcy.PharmcyWS webser = new Pharmcy.PharmcyWS();
        if (e.CommandName == "SendOrder")
        {
            webser.UpdateOrderSupplied(orderId);
            //show all the orders
            SortButton_Click(sender, e);
        }
        if (e.CommandName == "DeleteOrder")
        {
            webser.DeleteOrder(orderId);
            //show all the orders
            SortButton_Click(sender, e);
        }
        if (e.CommandName == "SeeDetails")
        {
            if (ShowDetails.Visible == false)
            {
                DataSet ds = webser.GetDetailsAboutOrder(orderId);
                ShowDetails.Visible    = true;
                ShowDetails.DataSource = ds;
                ShowDetails.DataBind();
                for (int i = 0; i < ShowOrder.Rows.Count; i++)
                {
                    ShowOrder.Rows[i].Font.Bold = false;
                }
                ShowOrder.Rows[rowNumber].Font.Bold = true;
            }
        }
    }
예제 #5
0
    protected void SendPrescription_Click(object sender, EventArgs e)
    {
        UserIdO.Text        = "";
        MedicineNameO.Text  = "";
        MedicineCountO.Text = "";
        Doctor d       = (Doctor)Session["doctor"];
        bool   isValid = true;

        if (MedicineNameDDL.SelectedIndex == 0)
        {
            isValid            = false;
            MedicineNameO.Text = "לא בחרת תרופה";
        }
        if (UserNameDDL.SelectedIndex == 0)
        {
            isValid      = false;
            UserIdO.Text = "לא בחרת לקוח";
        }
        if (MedicineCountTB.Text != "" && Validation.IsHouseNumberValid(MedicineCountTB.Text))
        {
            if (Convert.ToInt32(MedicineCountTB.Text) <= 0)
            {
                isValid             = false;
                MedicineCountO.Text = "כמות לא תקינה";
            }
        }
        else
        {
            isValid             = false;
            MedicineCountO.Text = "כמות לא תקינה";
        }
        if (isValid)
        {
            int count = Convert.ToInt32(MedicineCountTB.Text);
            Pharmcy.PharmcyWS  webser = new Pharmcy.PharmcyWS();
            Prescription       newp   = new Prescription();
            PrescriptioService ps     = new PrescriptioService();
            newp.CPrescriptionMedicineId = Convert.ToInt32(MedicineNameDDL.SelectedValue);
            DataSet ds = ps.IsPresAlreadyExist(newp.CPrescriptionMedicineId);
            if (ds.Tables[0].Rows.Count != 0)
            {
                int currentCount = Convert.ToInt32(ds.Tables[0].Rows[0]["PrescriptionMedicineCount"].ToString());
                ps.UpdatePresMedCount(newp.CPrescriptionMedicineId, (currentCount + count));
                ResetData_Click(sender, e);
                Response.Write("<script>alert('המרשם נשלח בהצלחה')</script>");
                return;
            }
            newp.CPrescriptionUserId           = UserNameDDL.SelectedValue;
            newp.CPrescriptionDoctorId         = d.CDoctorId;
            newp.CPrescriptionDate             = DateTime.Now;
            newp.CPrescriptionMedicineCount    = count;
            newp.CPrescriptionMedicineName     = MedicineNameDDL.SelectedItem.Text;
            newp.CPrescriptionMedicineCatagory = webser.GetMedicineCatagory(newp.CPrescriptionMedicineId);
            ps.InsertPrescriptionToDataBase(newp);
            ResetData_Click(sender, e);
            //say the prescription send succesfully
            Response.Write("<script>alert('המרשם נשלח בהצלחה')</script>");
        }
    }
예제 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //put the exit button in the menu
        //
        //EXIT BUTTON
        //the exit button will delete the user shopping bag(set the value to be null)
        //and doesnt change the current stock of the medicine.
        //
        //do a method that rrecives object, the session value of myShoppingbag will be an object
        //and a shopping bag variable.
        if (!Page.IsPostBack)
        {
            if (Session["myShoppingBag"] == null)
            {
                //create shopping list
                Session["myShoppingBag"] = new ShoppingBag();
            }
            else
            {
                myShoppingBag = (ShoppingBag)Session["myShoppingBag"];
            }
            if (Session["presList"] == null)
            {
                Session["presList"] = new List <DataSet>();
            }
            else
            {
                presList = (List <DataSet>)Session["presList"];
            }

            //put the catagorys and the producers in the DDL
            Pharmcy.PharmcyWS webser = new Pharmcy.PharmcyWS();
            DataSet           pro = webser.GetProducer(), cat = webser.GetCatagory();
            List <ListItem>   proList = GetAllData.getListItemsForDDL(pro, "MedicineProducer");
            List <ListItem>   catList = GetAllData.getListItemsForDDL(cat, "MedicineCatagory");
            foreach (ListItem l in proList)
            {
                ProducerDDL.Items.Add(l);
            }
            foreach (ListItem l in catList)
            {
                DropDownListMedicineCatagory.Items.Add(l);
            }
        }
        CheckoutButton.Visible = true;
        SeeShoppingBag.Visible = true;
        User u = (User)Session["user"];

        if (u == null)
        {
            CheckoutButton.Visible = false;
            SeeShoppingBag.Visible = false;
        }
    }
예제 #7
0
    protected void ShowPrescriptionGrid_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "UsePrescription")
        {
            int rowNumber            = Convert.ToInt32(e.CommandArgument);
            int presId               = Convert.ToInt32(ShowPrescriptionGrid.Rows[rowNumber].Cells[0].Text);
            int medId                = Convert.ToInt32(ShowPrescriptionGrid.Rows[rowNumber].Cells[3].Text);
            int medCount             = Convert.ToInt32(ShowPrescriptionGrid.Rows[rowNumber].Cells[5].Text);
            Pharmcy.PharmcyWS webser = new Pharmcy.PharmcyWS();
            int medStock             = webser.GetMedicineStock(medId);
            if (medCount > medStock)
            {
                Response.Write("<script>alert('אין מספיק תרופות במלאי')</script>");
                return;
            }
            webser.UpdateMedCount(medStock - medCount, medId);
            PrescriptioService ps = new PrescriptioService();
            //get the total price of the prescription
            int medPrice   = webser.GetMedicinePrice(medId);
            int totalPrice = medPrice * medCount;
            ps.DeletePrescription(presId);
            Response.Write("<script>alert('המרשם מומש בהצלחה, עלות ההזמנה היא: " + totalPrice + " שקלים')</script>");
            SortPrescription_SelectedIndexChanged(sender, e);
            //need to put this unfinished code in the page of PAYMENT

            //get a redirect to the page of PAYMENT

            //put in the basket the prescription items and wait for premition to check out
            //there is no PAYMENT WEBSITE in this PROJECT
            //or just do a POP UP that says the prescription has been used and the deatails of the order
            //like in the APPOINTMENT PAGE for the USER

            //delete the prescription from database
        }
        if (e.CommandName == "ShowMedicinePrice")
        {
            int               rowNumber = Convert.ToInt32(e.CommandArgument);
            int               medId     = Convert.ToInt32(ShowPrescriptionGrid.Rows[rowNumber].Cells[3].Text);
            string            medName   = ShowPrescriptionGrid.Rows[rowNumber].Cells[4].Text;
            Pharmcy.PharmcyWS webser    = new Pharmcy.PharmcyWS();
            int               medPrice  = webser.GetMedicinePrice(medId);
            Response.Write("<script>alert('מחיר חבילת " + medName + " הוא " + medPrice + " שקלים')</script>");
        }
    }
예제 #8
0
    protected void SortDDL_SelectedIndexChanged(object sender, EventArgs e)
    {
        int    x     = SortDDL.SelectedIndex;
        string order = "";

        switch (x)
        {
        case 1:
        {
            order = " ORDER BY OrderTotalMoney DESC";
            break;
        }

        case 3:
        {
            order = " ORDER BY OrderIsSupplied";
            break;
        }

        case 2:
        {
            order = " ORDER BY OrderDate";
            break;
        }
        }
        Pharmcy.PharmcyWS webser = new Pharmcy.PharmcyWS();
        DataSet           ds     = webser.GetUserOrders((string)Session["userId"], order);

        if (ds.Tables[0].Rows.Count != 0)
        {
            ShowOrder.Visible    = true;
            ShowDetails.Visible  = false;
            CloseOrders.Visible  = true;
            ShowOrder.DataSource = ds;
            ShowOrder.DataBind();
        }
        else
        {
            CloseOrders_Click(sender, e);
            Response.Write("<script>alert('לא נמצאו הזמנות')</script>");
        }
    }
예제 #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         Manager m = (Manager)Session["manager"];
         HelloLabel.Text = m.CManagerName;
         Pharmcy.PharmcyWS webser = new Pharmcy.PharmcyWS();
         DataSet           ds     = webser.GetAllOrders("");
         if (ds.Tables[0].Rows.Count != 0)
         {
             CloseOrders.Visible  = true;
             ShowOrder.Visible    = true;
             ShowOrder.DataSource = ds;
             ShowOrder.DataBind();
         }
         else
         {
             Response.Write("<script>alert('לא נמצאו הזמנות')</script>");
         }
     }
 }
예제 #10
0
    protected void SortButton_Click(object sender, EventArgs e)
    {
        table1.Visible = false;
        DataSet ds;
        string  whereclout = "";
        string  str        = "qwertyuiopasdfghjkl;zxcvbnm|,./'[]{}\\`!@#$%^&*()_-+=*.<>QWERTYUIOPASDFGHJKLZXCVBNM";

        if (MoneyFrom.Text != "" || MoneyTo.Text != "")
        {
            for (int i = 0; i < str.Length; i++)
            {
                if (MoneyFrom.Text.IndexOf(str[i]) != -1)
                {
                    Response.Write("<script>alert('טווח מחירים לא תקין')</script>");
                    return;
                }
                if (MoneyTo.Text.IndexOf(str[i]) != -1)
                {
                    Response.Write("<script>alert('טווח מחירים לא תקין')</script>");
                    return;
                }
            }
        }
        //init
        SearchReasultGrid.Visible = true;
        CloseMedicineGrid.Visible = true;
        //end init
        //creating the sort SQL line
        int pro = ProducerDDL.SelectedIndex + 1;
        int cat = DropDownListMedicineCatagory.SelectedIndex + 1;

        if (pro > 1)
        {
            if (whereclout != "")
            {
                whereclout = whereclout + " and ";
            }
            else
            {
                whereclout = " where ";
            }
            whereclout = whereclout + "MedicineProducer=" + pro;
        }
        if (cat > 1)
        {
            if (whereclout != "")
            {
                whereclout = whereclout + " and ";
            }
            else
            {
                whereclout = " where ";
            }
            whereclout = whereclout + "MedicineCatagory=" + cat;
        }
        if (MoneyFrom.Text != "")
        {
            if (whereclout != "")
            {
                whereclout = whereclout + " and ";
            }
            else
            {
                whereclout = " where ";
            }
            whereclout = whereclout + "MedicinePrice> " + Convert.ToInt32(MoneyFrom.Text);
        }
        if (MoneyTo.Text != "")
        {
            if (whereclout != "")
            {
                whereclout = whereclout + " and ";
            }
            else
            {
                whereclout = " where ";
            }
            whereclout = whereclout + "MedicinePrice< " + Convert.ToInt32(MoneyTo.Text);
        }
        string man = ManualSearch.Text;

        if (man != "")
        {
            if (whereclout != "")
            {
                whereclout = whereclout + " and ";
            }
            else
            {
                whereclout = " where ";
            }
            whereclout = whereclout + "(MedicineName LIKE '%" + man + "%')";
        }
        if (WithPresRB.Checked == true)
        {
            if (whereclout != "")
            {
                whereclout = whereclout + " and ";
            }
            else
            {
                whereclout = " where ";
            }
            whereclout = whereclout + "MedicineNeedPrescription=true";
        }
        if (WithoutPresRB.Checked == true)
        {
            if (whereclout != "")
            {
                whereclout = whereclout + " and ";
            }
            else
            {
                whereclout = " where ";
            }
            whereclout = whereclout + "MedicineNeedPrescription=false";
        }
        if (whereclout != "")
        {
            whereclout = whereclout + " and ";
        }
        else
        {
            whereclout = " where ";
        }
        whereclout = whereclout + "MedicineProducer=MedicineProducerId and MedicineCatagoryId=MedicineCatagory";

        Pharmcy.PharmcyWS web = new Pharmcy.PharmcyWS();
        ds = web.SortMedicine(whereclout);
        if (ds.Tables[0].Rows.Count == 0)
        {
            CloseMedicineGrid.Visible = false;
            Response.Write("<script>alert('לא נמצאו תרופות')</script>");
            CloseMedicineGrid_Click(sender, e);
            return;
        }
        SearchReasultGrid.DataSource = ds;
        SearchReasultGrid.DataBind();
        table1.Visible = true;
    }
예제 #11
0
    protected void CheckoutButton_Click(object sender, EventArgs e)
    {
        User temp = (User)Session["user"];

        if (temp == null)
        {
            Response.Write("<script>alert('על מנת לרכוש מוצרים עליך להיות לקוח רשום')</script>");
            Response.Write("<script>window.open('http://localhost:49675/GuestHome.aspx');</script>");
            return;
        }
        ShoppingBag sb = (ShoppingBag)Session["myShoppingBag"];

        if (sb == null || sb.isEmpty())
        {
            Response.Write("<script>alert('הסל ריק')</script>");
            return;
        }
        //delete all the prescription from database
        presList = (List <DataSet>)Session["presList"];
        int presId;
        PrescriptioService ps = new PrescriptioService();

        if (presList != null)
        {
            foreach (DataSet d in presList)
            {
                presId = Convert.ToInt32(d.Tables[0].Rows[0]["PrescriptionId"].ToString());
                ps.DeletePrescription(presId);
            }
        }
        //update all the medicine stock according to the current count
        Pharmcy.PharmcyWS webser = new Pharmcy.PharmcyWS();
        int totalPrice = sb.GetTotalPrice();
        List <MedicineInBag> medList = sb.GetProducts();
        int countOfMedicine = 0, size = sb.getSize(), index = 0;

        //create medicineInBag variables
        string[] id = new string[size], name = new string[size], pn = new string[size], cn = new string[size];
        int[]    price = new int[size], s = new int[size], pro = new int[size], cat = new int[size], count = new int[size];
        bool[]   p  = new bool[size];
        foreach (MedicineInBag m in medList)
        {
            id[index]    = m.CMedicineId;
            name[index]  = m.CMedicineName;
            pn[index]    = m.CMedicineInBagProducerName;
            cn[index]    = m.CMedicineInBagCatagoryName;
            price[index] = m.CMedicinePrice;
            s[index]     = m.CMedicineStock;
            pro[index]   = m.CMedicineProducer;
            cat[index]   = m.CMedicineCatagory;
            p[index]     = m.CMedicineNeedPrescription;
            count[index] = m.CMedicineInBagMedicineCount;
            index++;


            /////////////////////////////////////////////////////////////////////////

            /*
             * int currentStock = webser.GetMedicineStock(Convert.ToInt32(m.CMedicineId));
             * countOfMedicine = currentStock - m.CMedicineInBagMedicineCount;
             * webser.UpdateMedCount(countOfMedicine,Convert.ToInt32(m.CMedicineId));
             */
            //////////////////////////////////////////////////////////////////////////
        }
        //inseat to data base
        User u = (User)Session["user"];

        /*
         *
         * ///////////
         * os.InsertOrder(o);
         * ////////////////
         * ///*/
        ////////////////////////////////////////////////////////////////////////////
        webser.InseartOrder(id, name, price, p, s, pro, cat, pn, cn, count, u.CUserId);
        ////////////////////////////////////////////////////////////////////////////

        //init the shopping bag and the prescription list
        presList            = new List <DataSet>();
        Session["presList"] = new List <DataSet>();
        sb = new ShoppingBag();
        Session["myShoppingBag"] = new ShoppingBag();
        Response.Write("<script>alert('ההזמנה בוצעה בהצלחה, עלות ההזמנה היא: " + totalPrice + " שקלים')</script>");
        SortButton_Click(sender, e);
    }
예제 #12
0
    protected void SearchReasultGrid_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "AddMedicine")
        {
            //check if the user is logged in, if not get him a message about it and redirect him to the regestrataion page
            User s = (User)Session["user"];
            if (s == null)
            {
                Response.Write("<script>alert('על מנת לרכוש מוצרים עליך להיות לקוח רשום')</script>");
                Response.Write("<script>window.open('http://localhost:49675/GuestHome.aspx','_blank');</script>");
                return;
            }

            //get the shopping bag
            myShoppingBag = (ShoppingBag)Session["myShoppingBag"];

            int rowNumber = Convert.ToInt32(e.CommandArgument);
            //create the medicineInBag var
            Pharmcy.PharmcyWS webser = new Pharmcy.PharmcyWS();
            MedicineInBag     MIB    = new MedicineInBag();
            MIB.CMedicineName  = SearchReasultGrid.Rows[rowNumber].Cells[1].Text;
            MIB.CMedicineId    = SearchReasultGrid.Rows[rowNumber].Cells[0].Text;
            MIB.CMedicinePrice = Convert.ToInt32(SearchReasultGrid.Rows[rowNumber].Cells[2].Text);
            MIB.CMedicineInBagMedicinePrice = Convert.ToInt32(MIB.CMedicinePrice);
            MIB.CMedicineNeedPrescription   = Convert.ToBoolean(SearchReasultGrid.Rows[rowNumber].Cells[6].Text);
            MIB.CMedicineStock = Convert.ToInt32(SearchReasultGrid.Rows[rowNumber].Cells[3].Text);
            //same in MedicineCatagory
            MIB.CMedicineProducer = webser.GetMedicineProducer(Convert.ToInt32(MIB.CMedicineId));
            MIB.CMedicineCatagory = webser.GetMedicineCatagory(Convert.ToInt32(MIB.CMedicineId));
            DataSet temp = webser.GetMedicineCataAndProName(MIB.CMedicineCatagory, MIB.CMedicineProducer);
            MIB.CMedicineInBagCatagoryName = temp.Tables[0].Rows[0]["MedicineCatagoryName"].ToString();
            MIB.CMedicineInBagProducerName = temp.Tables[0].Rows[0]["MedicineProducerName"].ToString();

            ///////////////////////////////////////////////////////////////////////////////////
            //check count of medicine
            //because we didnt change the current stock of the medicine we need to check if there is
            //enough from this medicine to buy
            int  countOfMedicine = myShoppingBag.GetMedicineCount(Convert.ToInt32(MIB.CMedicineId));
            User u = (User)Session["user"];
            if (MIB.CMedicineStock - countOfMedicine <= 0)
            {
                Response.Write("<script>alert('אין מספיק תרופות במלאי')</script>");
                return;
            }

            ///////////////////////////////////////////////////////////////////////////////////

            //check prescription
            int MedIdNumber = Convert.ToInt32(MIB.CMedicineId);
            //still dont change the current stock of medicine
            if (MIB.CMedicineNeedPrescription)
            {
                PrescriptioService ps = new PrescriptioService();
                DataSet            ds = ps.GetPrescriptionByMedicineId(MedIdNumber, u.CUserId);
                if (ds.Tables[0].Rows.Count == 0)
                {
                    Response.Write("<script>alert('תרופה זאת צריכה מרשם')</script>");
                    return;
                }
                else
                {
                    //לבדוק אם הוא באמת הכניס אותה כמות
                    //אם הוא הכניס אותה כמות אז הכל בסדר
                    //צריך לזכור לבטל את המרשם ברגע שהקנייה מתבצעת
                    //אם הכמות לא שווה אז ליידע את הלקוח שהוא צריך לבדוק כמה כדורים נתנו לו
                    //אפשרות לחשוף קישור בדף לעמוד של המרשמים כדי שיוכל להסתכל
                    //או שאפשר להגיד למשתמש כמה כדורים הוא יכול לקחת(מעדיף שלא נשמע קצת מוזר)
                    presList = (List <DataSet>)Session["presList"];
                    if (presList != null)
                    {
                        foreach (DataSet d in presList)
                        {
                            if (ds.Tables[0].Rows[0]["PrescriptionId"].ToString() == d.Tables[0].Rows[0]["PrescriptionId"].ToString())
                            {
                                Response.Write("<script>alert('מרשם זה כבר שומש')</script>");
                                return;
                            }
                        }
                    }
                    presList.Add(ds);
                    Session["presList"] = presList;
                    int count = Convert.ToInt32(ds.Tables[0].Rows[0]["PrescriptionMedicineCount"].ToString());
                    MIB.CMedicineInBagMedicineCount = count;
                }
            }
            else
            {
                MIB.CMedicineInBagMedicineCount = 1;
            }
            myShoppingBag.AddMedicine(MIB);
            Session["myShoppingBag"] = myShoppingBag;
            Response.Write("<script>alert('המוצר הוסף לסל')</script>");
            CheckoutButton.Visible = true;
            SeeShoppingBag.Visible = true;
        }
    }
예제 #13
0
    protected void SortButton_Click(object sender, EventArgs e)
    {
        string order = " ORDER BY ", temp = order;

        if (HighToLow.Checked)
        {
            if (order.Equals(temp))
            {
                order += "OrderTotalMoney DESC";
            }
            else
            {
                order += ",OrderTotalMoney DESC";
            }
        }
        if (LowToHigh.Checked)
        {
            if (order.Equals(temp))
            {
                order += "OrderTotalMoney ASC";
            }
            else
            {
                order += ",OrderTotalMoney ASC";
            }
        }
        if (SortUser.Checked)
        {
            if (order.Equals(temp))
            {
                order += "OrderUserId ASC";
            }
            else
            {
                order += ",OrderUserId ASC";
            }
        }
        if (SortDate.Checked)
        {
            if (order.Equals(temp))
            {
                order += "OrderDate";
            }
            else
            {
                order += ",OrderDate";
            }
        }
        if (IsSupplied.Checked)
        {
            if (order.Equals(temp))
            {
                order += "OrderIsSupplied";
            }
            else
            {
                order += ",OrderIsSupplied";
            }
        }
        if (order.Equals(temp))
        {
            order = "";
        }
        Pharmcy.PharmcyWS webser = new Pharmcy.PharmcyWS();
        //sort the orders
        DataSet ds = webser.GetAllOrders(order);

        if (ds.Tables[0].Rows.Count != 0)
        {
            ShowOrder.Visible    = true;
            ShowDetails.Visible  = false;
            CloseOrders.Visible  = true;
            ShowOrder.DataSource = ds;
            ShowOrder.DataBind();
        }
        else
        {
            CloseOrders_Click(sender, e);
            Response.Write("<script>alert('לא נמצאו הזמנות')</script>");
        }
    }