public static void SelectCBLItems(CheckBoxList CBL, int Bits)
        {
            int      nBits       = CBL.Items.Count;
            int      allBitsMask = Convert.ToInt32(((Math.Pow(2, nBits))) - 1);
            ListItem li          = null;

            if ((Bits & allBitsMask) == allBitsMask)
            {
                SelectAllCBLItems(CBL);
            }
            else
            {
                int n = nBits - 1;
                CBL.ClearSelection();
                do
                {
                    if ((Bits & 0x1) != 0)
                    {
                        li = CBL.Items.FindByValue(n.ToString());
                        if (li != null && li.Enabled)
                        {
                            li.Selected = true;
                        }
                    }
                    Bits >>= 1;
                    n--;
                } while (n >= 0);
            }
        }
    //bind sub menu
    protected void BindSubMenus(CheckBoxList chksubmenulist, int idparent)
    {
        AdminManager objuser = new AdminManager();

        try
        {
            DataSet dtmenu = new DataSet();
            chksubmenulist.Items.Clear();
            chksubmenulist.ClearSelection();
            objuser.parentid = idparent;
            dtmenu           = objuser.selectSubMenus();
            if (dtmenu.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < dtmenu.Tables[0].Rows.Count; i++)
                {
                    chksubmenulist.Items.Add(dtmenu.Tables[0].Rows[i]["title"].ToString());
                    chksubmenulist.Items[i].Value = dtmenu.Tables[0].Rows[i]["idmenu"].ToString();

                    if (Request.QueryString["flag"] == "edit")
                    {
                        objuser.adminid = Convert.ToInt32(Request.QueryString["id"]);
                    }

                    objuser.idmenu = Convert.ToInt32(dtmenu.Tables[0].Rows[i]["idmenu"]);
                    if (objuser.getAdminmenu() > 0)
                    {
                        chksubmenulist.Items[i].Selected = true;
                    }
                }
            }
            dtmenu.Dispose();
        }
        catch (Exception ex) { throw ex; }
        finally { objuser = null; }
    }
        public void blank()
        {
            for (int i = 0; i < reproles.Items.Count; i++)
            {
                CheckBoxList rbtnroles = ((CheckBoxList)reproles.Items[i].FindControl("rbtnroles"));
                rbtnroles.ClearSelection();
            }



            hidid.Value                   = "";
            txtfname.Text                 = "";
            txtlname.Text                 = "";
            txtpassword.Text              = "";
            txtempid.Text                 = "";
            dropmanager.SelectedIndex     = 0;
            dropsubmitto.SelectedIndex    = 0;
            dropdepartment.SelectedIndex  = 0;
            dropdesignation.SelectedIndex = 0;
            txtjoin.Text                  = "";
            txtrelived.Text               = "";
            txtcompanyemail.Text          = "";
            dropactive.SelectedIndex      = 0;
            hidaddress.Value              = "";
            dropemptype.SelectedIndex     = 0;
            txtlname.Text                 = "";
            dropcity.SelectedIndex        = 0;
            dropstate.SelectedIndex       = 0;
            dropcountry.SelectedIndex     = 0;
            txtzip.Text                   = "";
            txtphone.Text                 = "";
            txtcell.Text                  = "";
            txtemail.Text                 = "";
            txtfax.Text                   = "";
            txtremark.Text                = "";

            txtenrollno.Text           = "";
            hidrate.Value              = "";
            txtbillrate.Text           = "";
            txtpayrate.Text            = "";
            txtovertimebill.Text       = "";
            txtovertimepayrate.Text    = "";
            dropcurrency.SelectedIndex = 0;
            txtoverhead.Text           = "";
            txtsalary.Text             = "";
            btndelete.Visible          = false;
            btnsubmit.Text             = "Save";
            txtempid.Enabled           = true;
            droptimezone.Text          = Session["timeid"].ToString();

            txtdob.Text = "";
            droproletype.SelectedIndex = 0;


            //ltrNetSalary.InnerHtml = "0.00";
            //ltrtotaldeduction.InnerHtml = "0.00";
            //ltrGrossSalary.InnerText = "0.00";
        }
Exemple #4
0
        protected void Calendar1_SelectionChanged(object sender, EventArgs e)
        {
            if (Calendar1.SelectedDate <= DateTime.Today)                                                                                            // if any past day is selected or today's date is selected
            {
                Response.Write("<script>alert('Meetings need to be scheduled atleast 24 hours prior. Please select an appropiate date ')</script>"); // display warning to user
                Calendar1.SelectedDate = DateTime.Today.AddDays(1);                                                                                  // automatically set date selection to current dat
            }

            cblist.ClearSelection();
        }
 /// <summary>
 /// Select items in a CheckBoxList from a List&lt;string&gt; of values
 /// </summary>
 /// <param name="items">List&lt;string&gt; of values to be marked selected</param>
 /// <param name="checkBoxList">CheckBoxList to be populated</param>
 public static void SelectCheckBoxListItems(List <string> items, CheckBoxList checkBoxList)
 {
     checkBoxList.ClearSelection();
     foreach (ListItem listItem in checkBoxList.Items)
     {
         if (items.Contains(listItem.Value))
         {
             listItem.Selected = true;
         }
     }
 }
Exemple #6
0
        public void RejectFilter()
        {
            LiveFilterBox.Text = null;
            CheckBoxList.ClearSelection();
            if (FilterCanceled != null)
            {
                FilterCanceled(this, EventArgs.Empty);
            }

            //ApplyFilter_Click(this, EventArgs.Empty);
        }
Exemple #7
0
 public static void SelectAND(this CheckBoxList cbl, long valueSum)
 {
     cbl.ClearSelection();
     foreach (ListItem li in cbl.Items)
     {
         long val = li.Value.ToLong();
         if ((val & valueSum) == val)
         {
             li.Selected = true;
         }
     }
 }
Exemple #8
0
    public static void SetListCheckedByValue(CheckBoxList BoxName, string Value)
    {
        string Temp = string.Empty;

        string[] ItemValue = Value.Split(',');
        BoxName.ClearSelection();
        foreach (string Item in ItemValue)
        {
            if (BoxName.Items.Contains(BoxName.Items.FindByValue(Item)))
            {
                BoxName.Items.FindByValue(Item).Selected = true;
            }
        }
    }
 /// <summary>
 /// Select items in a CheckBoxList from a List of TopicCode
 /// </summary>
 /// <param name="items">List of TopicCode  to be marked selected</param>
 /// <param name="checkBoxList">CheckBoxList to be populated</param>
 public static void SelectCheckBoxListItems(List <TopicCode> items, CheckBoxList checkBoxList)
 {
     checkBoxList.ClearSelection();
     if (items.Count > 0)
     {
         foreach (ListItem listItem in checkBoxList.Items)
         {
             TopicCode selected = items.Find(i => i.Id.ToString() == listItem.Value);
             if (selected != null)
             {
                 listItem.Selected = true;
             }
         }
     }
 }
Exemple #10
0
        protected void SwitchButton_Click(object sender, EventArgs e)
        {
            if (GroupListRow.Visible)
            {
                UserListRow.Visible  = true;
                GroupListRow.Visible = false;
                UserList.ClearSelection();
            }
            else if (UserListRow.Visible)
            {
                UserListRow.Visible  = false;
                GroupListRow.Visible = true;
                GroupList.ClearSelection();
            }

            Settings.GroupIdList.Clear();
            Settings.InstanceId = Guid.Empty;
            Settings.Visible    = false;

            LoadObjectName();
        }
    private void CargarGrillaTiposDesdeTabla(DataTable tablaTipos)
    {
        GridView_Tipos.DataSource = tablaTipos;
        GridView_Tipos.DataBind();

        for (int i = 0; i < GridView_Tipos.Rows.Count; i++)
        {
            GridViewRow filaGrilla = GridView_Tipos.Rows[i];
            DataRow     filaTabla  = tablaTipos.Rows[i];

            TextBox textoNombre = filaGrilla.FindControl("TextBox_Nombre") as TextBox;
            textoNombre.Text = filaTabla["NOMBRE"].ToString().Trim();

            DropDownList dropEstado = filaGrilla.FindControl("DropDownList_Estado") as DropDownList;
            dropEstado.SelectedValue = filaTabla["ACTIVA"].ToString();

            CheckBoxList checkSecciones       = filaGrilla.FindControl("CheckBoxList_Secciones") as CheckBoxList;
            String       seccionesHabilitadas = filaTabla["SECCIONES_HABILITADAS"].ToString().Trim();
            checkSecciones.ClearSelection();
            if (seccionesHabilitadas.Contains("Resultados Encuesta") == true)
            {
                checkSecciones.Items[0].Selected = true;
            }

            if (seccionesHabilitadas.Contains("Control Asistencia") == true)
            {
                checkSecciones.Items[1].Selected = true;
            }

            if (seccionesHabilitadas.Contains("Entidades Colaboradoras") == true)
            {
                checkSecciones.Items[2].Selected = true;
            }

            if (seccionesHabilitadas.Contains("Compromisos") == true)
            {
                checkSecciones.Items[3].Selected = true;
            }
        }
    }
 public static void ClearAllSelectedCBLItems(CheckBoxList CBL)
 {
     CBL.ClearSelection();
 }
        protected void PaggedGridbtnedit_Click(object sender, EventArgs e)
        {
            objuser.id = hidid.Value;
            blank();
            hidid.Value    = objuser.id;
            objuser.action = "select";

            ds = objuser.ManageEmployee();

            if (ds.Tables[0].Rows.Count > 0)
            {
                txtempid.Text        = ds.Tables[0].Rows[0]["loginid"].ToString();
                txtfname.Text        = ds.Tables[0].Rows[0]["fname"].ToString();
                txtlname.Text        = ds.Tables[0].Rows[0]["lname"].ToString();
                txtpassword.Text     = ds.Tables[0].Rows[0]["password"].ToString();
                txtcompanyemail.Text = ds.Tables[0].Rows[0]["emailid"].ToString();
                try
                {
                    dropmanager.Text = ds.Tables[0].Rows[0]["managerid"].ToString();
                }
                catch
                {
                    dropmanager.SelectedIndex = 0;
                }
                try
                {
                    dropsubmitto.Text = ds.Tables[0].Rows[0]["submitto"].ToString();
                }
                catch
                {
                    dropsubmitto.SelectedIndex = 0;
                }
                try
                {
                    dropdepartment.Text = ds.Tables[0].Rows[0]["deptid"].ToString();
                }
                catch
                {
                    dropdepartment.SelectedIndex = 0;
                }



                dropdesignation.Text = ds.Tables[0].Rows[0]["desigid"].ToString();
                txtjoin.Text         = ds.Tables[0].Rows[0]["joindate"].ToString();
                txtrelived.Text      = ds.Tables[0].Rows[0]["releaseddate"].ToString();
                txtenrollno.Text     = ds.Tables[0].Rows[0]["enrollno"].ToString();
                droproletype.Text    = ds.Tables[0].Rows[0]["roletype"].ToString();
                droptimezone.Text    = ds.Tables[0].Rows[0]["timezone"].ToString();

                txtdob.Text = ds.Tables[0].Rows[0]["dob"].ToString();

                if (ds.Tables[0].Rows[0]["branchtype"] != null && ds.Tables[0].Rows[0]["branchtype"].ToString() != "")
                {
                    dropemptype.Text = ds.Tables[0].Rows[0]["branchtype"].ToString();
                }
                dropactive.Text = ds.Tables[0].Rows[0]["activestatus"].ToString();

                for (int i = 0; i < reproles.Items.Count; i++)
                {
                    CheckBoxList rbtnroles = ((CheckBoxList)reproles.Items[i].FindControl("rbtnroles"));

                    rbtnroles.ClearSelection();
                }



                if (ds.Tables[0].Rows[0]["roles"].ToString() != "")
                {
                    string[] strroles = ds.Tables[0].Rows[0]["roles"].ToString().Split('#');
                    for (int i = 0; i < strroles.Length; i++)
                    {
                        for (int k = 0; k < reproles.Items.Count; k++)
                        {
                            CheckBoxList rbtnroles = ((CheckBoxList)reproles.Items[k].FindControl("rbtnroles"));

                            for (int j = 0; j < rbtnroles.Items.Count; j++)
                            {
                                if (rbtnroles.Items[j].Value == strroles[i])
                                {
                                    rbtnroles.Items[j].Selected = true;
                                }
                            }
                        }
                    }
                }

                if (ds.Tables[1].Rows.Count > 0)
                {
                    //Fill Address
                    hidaddress.Value = ds.Tables[1].Rows[0]["nid"].ToString();
                    txtstreet.Text   = ds.Tables[1].Rows[0]["street"].ToString();


                    ListItem itemToSelect = dropcountry.Items.FindByText(ds.Tables[1].Rows[0]["country"].ToString());
                    if (itemToSelect != null)
                    {
                        dropcountry.Text = itemToSelect.Value;
                    }
                    fillstate();

                    ListItem itemToSelect1 = dropstate.Items.FindByText(ds.Tables[1].Rows[0]["state"].ToString());
                    if (itemToSelect1 != null)
                    {
                        dropstate.Text = itemToSelect1.Value;
                    }
                    fillcity();

                    ListItem itemToSelect2 = dropcity.Items.FindByText(ds.Tables[1].Rows[0]["city"].ToString());
                    if (itemToSelect2 != null)
                    {
                        dropcity.Text = itemToSelect2.Value;
                    }


                    txtzip.Text    = ds.Tables[1].Rows[0]["zip"].ToString();
                    txtemail.Text  = ds.Tables[1].Rows[0]["email"].ToString();
                    txtphone.Text  = ds.Tables[1].Rows[0]["phone"].ToString();
                    txtcell.Text   = ds.Tables[1].Rows[0]["mobile"].ToString();
                    txtfax.Text    = ds.Tables[1].Rows[0]["fax"].ToString();
                    txtremark.Text = ds.Tables[1].Rows[0]["remark"].ToString();
                }
                else
                {
                    hidaddress.Value = "";
                }
                if (ds.Tables[2].Rows.Count > 0)
                {
                    hidrate.Value           = ds.Tables[2].Rows[0]["nid"].ToString();
                    txtbillrate.Text        = ds.Tables[2].Rows[0]["billrate"].ToString();
                    txtpayrate.Text         = ds.Tables[2].Rows[0]["payrate"].ToString();
                    txtovertimebill.Text    = ds.Tables[2].Rows[0]["overtimeBillRate"].ToString();
                    txtovertimepayrate.Text = ds.Tables[2].Rows[0]["overtimePayrate"].ToString();
                    dropcurrency.Text       = ds.Tables[2].Rows[0]["currencyId"].ToString();
                    txtoverhead.Text        = ds.Tables[2].Rows[0]["overheadMulti"].ToString();
                    txtsalary.Text          = ds.Tables[2].Rows[0]["salaryAmount"].ToString();
                }
                else
                {
                    hidrate.Value = "";
                }

                btndelete.Visible = true;
                btnsubmit.Text    = "Update";
                //  txtempid.Enabled = false;



                ScriptManager.RegisterStartupScript(this, GetType(), "key", "<script type='text/javascript'>opendiv();</script>", false);
                upadatepanel1.Update();
            }
        }
Exemple #14
0
        public void ClearForm(CheckBoxList control)
        {
            CheckBoxList myControl = control;

            myControl.ClearSelection();
        }
Exemple #15
0
        protected void grdSiteMap_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int         ID    = int.Parse(e.CommandArgument.ToString());
            GridViewRow row   = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);
            int         index = row.RowIndex;

            if (e.CommandName == "Select")
            {
                List <MDMSVC.DC_SiteMap> objDS = new List <MDMSVC.DC_SiteMap>();
                objDS.Add(new MDMSVC.DC_SiteMap {
                    ID = ID
                });
                frmSiteNode.ChangeMode(FormViewMode.Edit);
                frmSiteNode.DataSource = objDS;
                frmSiteNode.DataBind();

                BindParent();
                BindRoles();

                DropDownList ddlParent         = (DropDownList)frmSiteNode.FindControl("ddlParent");
                CheckBoxList chkListRoles      = (CheckBoxList)frmSiteNode.FindControl("chkListRoles");
                TextBox      txtTitle          = (TextBox)frmSiteNode.FindControl("txtTitle");
                TextBox      txtUrl            = (TextBox)frmSiteNode.FindControl("txtUrl");
                TextBox      txtDescription    = (TextBox)frmSiteNode.FindControl("txtDescription");
                CheckBox     chkbIsSiteMapNode = (CheckBox)frmSiteNode.FindControl("chkbIsSiteMapNode");
                HiddenField  hdnSiteMapID      = (HiddenField)frmSiteNode.FindControl("hdnSiteMapID");

                hdnSiteMapID.Value        = System.Web.HttpUtility.HtmlDecode(grdSiteMap.Rows[index].Cells[0].Text);
                txtTitle.Text             = System.Web.HttpUtility.HtmlDecode(grdSiteMap.Rows[index].Cells[1].Text);
                txtDescription.Text       = System.Web.HttpUtility.HtmlDecode(grdSiteMap.Rows[index].Cells[2].Text);
                txtUrl.Text               = System.Web.HttpUtility.HtmlDecode(grdSiteMap.Rows[index].Cells[3].Text);
                chkbIsSiteMapNode.Checked = Convert.ToBoolean(grdSiteMap.Rows[index].Cells[6].Text);
                ddlParent.ClearSelection();

                //Disable parent dropdown and isSiteMap
                var ApplicationName     = Convert.ToString(ConfigurationManager.AppSettings["ApplicationName"]);
                var SelectedApplication = Convert.ToString(ddlApplilcation.SelectedItem);
                if (SelectedApplication == "MDM")
                {
                    ddlParent.Enabled         = true;
                    chkbIsSiteMapNode.Enabled = true;
                    if (ddlParent.Items.FindByText(System.Web.HttpUtility.HtmlDecode(grdSiteMap.Rows[index].Cells[4].Text)) != null)
                    {
                        ddlParent.Items.FindByText(System.Web.HttpUtility.HtmlDecode(grdSiteMap.Rows[index].Cells[4].Text)).Selected = true;
                    }
                }
                else
                {
                    ddlParent.Enabled         = false;
                    chkbIsSiteMapNode.Enabled = false;
                }

                chkListRoles.ClearSelection();
                string[] rolelist = null;
                if (!string.IsNullOrWhiteSpace(System.Web.HttpUtility.HtmlDecode(grdSiteMap.Rows[index].Cells[5].Text)))
                {
                    rolelist = System.Web.HttpUtility.HtmlDecode(grdSiteMap.Rows[index].Cells[5].Text).Split(new char[] { ',', ';' }, 512);
                    if (rolelist.Length > 0)
                    {
                        foreach (string role in rolelist)
                        {
                            if (chkListRoles.Items.FindByText(role) != null)
                            {
                                chkListRoles.Items.FindByText(role).Selected = true;
                            }
                        }
                    }
                }
            }
            else if (e.CommandName.ToString() == "SoftDelete")
            {
                TLGX_Consumer.MDMSVC.DC_SiteMap newObj = new MDMSVC.DC_SiteMap
                {
                    ID        = ID,
                    IsActive  = false,
                    Edit_Date = DateTime.Now,
                    Edit_User = System.Web.HttpContext.Current.User.Identity.Name
                };

                if (AccSvc.UpdateSiteMapNode(newObj))
                {
                    GetSiteMapMaster();
                }
                ;
            }
            else if (e.CommandName.ToString() == "UnDelete")
            {
                TLGX_Consumer.MDMSVC.DC_SiteMap newObj = new MDMSVC.DC_SiteMap
                {
                    ID        = ID,
                    IsActive  = true,
                    Edit_Date = DateTime.Now,
                    Edit_User = System.Web.HttpContext.Current.User.Identity.Name
                };

                if (AccSvc.UpdateSiteMapNode(newObj))
                {
                    GetSiteMapMaster();
                }
                ;
            }
        }