Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Manager"] != null)
            {
                registerUser.Style.Add("display", "inline");
                manager.Style.Add("display", "inline");
                loginProp.Style.Add("display", "none");
                userProp.Style.Add("display", "block");

            }
            else if (Session["Email"] != null)
            {
                registerUser.Style.Add("display", "inline");
                loginProp.Style.Add("display", "none");
                userProp.Style.Add("display", "block");

                if (Session["Manager"] != null)
                {
                    manager.Style.Add("display", "inline");
                }
                else
                {
                    ClientBL cBL = new ClientBL();
                    client = cBL.getClientByEmail(Session["Email"].ToString());
                    if (!client.contactName.Equals(""))
                    {
                        Name.InnerText = client.contactName;
                    }
                    else
                    {
                        Name.InnerText = client.name;
                    }
                    manager.Style.Add("display", "none");
                }
            }
            else
            {
                loginProp.Style.Add("display", "inline");
                userProp.Style.Add("display", "none");
                registerUser.Style.Add("display", "none");
                manager.Style.Add("display", "none");
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["Email"] != null)
     {
         clientBL = new ClientBL();
         cityBL = new CityBL();
         client = clientBL.getClientByEmail(Session["Email"].ToString());
         Email.Value = client.email;
         pass.Value = client.password;
         contactName.Value = client.contactName;
         NameC.Value = client.name;
         address.Value = client.address;
         city.Value = cityBL.getCityById(client.cityID);
         zipCode.Value = client.zipCode.ToString();
         phone.Value = client.phone;
         contactPhone.Value = client.contactPhone;
         openTime.Value = client.openTime;
         status.Value = client.status.ToString();
     }
 }
        protected void createTable(int tabletype)
        {
            ClientBL clientBL = new ClientBL();
            Table table = new Table();
            List<Client> clientList = new List<Client>();
            if (tabletype == 1)
            {
                clientList = clientBL.getNewClient();
                table = newClientTable;
            }
            else if (tabletype == 2)
            {
                clientList = clientBL.GetAllClient();
                table = allClientTable;
            }

            LevelPriceBL levePriceBL = new LevelPriceBL();
            List<LevelPrice> levelList = levePriceBL.GetAllLevels();
            CityBL cityBl = new CityBL();

            for (int i = 0; i < clientList.Count; i++)
            {
                TableRow dr = new TableRow();
                TableCell cell = new TableCell();
                //cell.Text = clientList[i].id.ToString();
                //dr.Cells.Add(cell);
                //cell = new TableCell();
                cell.Text = clientList[i].name;
                dr.Cells.Add(cell);
                cell = new TableCell();
                cell.Text = clientList[i].phone;
                dr.Cells.Add(cell);
                cell = new TableCell();
                cell.Text = clientList[i].address;
                dr.Cells.Add(cell);
                cell = new TableCell();
                cell.Text = cityBl.getCityById(clientList[i].cityID);
                dr.Cells.Add(cell);
                cell = new TableCell();
                cell.Text = clientList[i].zipCode.ToString();
                dr.Cells.Add(cell);
                cell = new TableCell();
                cell.Text = clientList[i].contactName;
                dr.Cells.Add(cell);
                cell = new TableCell();
                cell.Text = clientList[i].contactPhone;
                dr.Cells.Add(cell);
                cell = new TableCell();
                cell.Text = clientList[i].openTime;
                dr.Cells.Add(cell);
                cell = new TableCell();
                cell.Text = clientList[i].email;
                dr.Cells.Add(cell);
                cell = new TableCell();
                cell.Text = clientList[i].password;
                dr.Cells.Add(cell);
                cell = new TableCell();
                ///dropeDounList for level price///
                DropDownList level = new DropDownList();
                level.ID = "LevelStatus_" + tabletype.ToString()+"_" + i.ToString();
                level.Items.Add(new ListItem("בחר דרגה", "-1"));
                foreach (etgarPlus.Classes.LevelPrice c in levelList)
                {
                    level.Items.Add(new ListItem(c._level, c._id.ToString()));
                }
                if (clientList[i].levelPrice > 0)
                    level.SelectedIndex = clientList[i].levelPrice;
                cell.Controls.Add(level);
                dr.Cells.Add(cell);
                /////////////////////end DropDounList////

                HtmlAnchor statusButton = new HtmlAnchor();
                statusButton.ID = "statusID_" + tabletype.ToString() + "_" + i.ToString();
                statusButton.Attributes.Add("class", "StatusButton");
                statusButton.HRef = "javascript:void(0);";

                cell = new TableCell();
                if (clientList[i].status.ToString().Equals("2"))
                {
                    statusButton.InnerText = "עדכן";
                }
                else if (clientList[i].status.ToString().Equals("1"))
                {
                    statusButton.InnerText = "אישור";
                }

                cell.Controls.Add(statusButton);
                dr.Cells.Add(cell);

                table.Rows.Add(dr);

            }
            //if (tabletype == 1)
            //{
            //    newClientTable = table;
            //}
            //else if (tabletype == 2)
            //{
            //    allClientTable = table;
            //}
        }
        public static string updateLevelAndStatus(string idLevel)
        {
            int id = Convert.ToInt32(idLevel.Split(',')[0]);
            int level = Convert.ToInt32(idLevel.Split(',')[1]);

            ClientBL clientBL = new ClientBL();
            if (clientBL.updateLevel(id, level))
            {
                return "true";
            }
            return "false";
        }