public override void DataBind()
        {
            MultiSelectListBoxItem           one = new MultiSelectListBoxItem(0, "New");
            MultiSelectListBoxItem           two = new MultiSelectListBoxItem(1, "Updated");
            MultiSelectListBoxItemCollection col = new MultiSelectListBoxItemCollection();

            col.Add(one);
            col.Add(two);

            this.DataSource     = col;
            this.DataTextField  = "name";
            this.DataValueField = "id";

            base.DataBind();
        }
Example #2
0
        protected void grdVwTypeofCustomer_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //DbDataRecord dbRecord = (DbDataRecord)e.Row.DataItem;
                MultiSelectListBoxItem lItem = (MultiSelectListBoxItem)e.Row.DataItem;

                //Status Label
                Label lblStatus = (Label)e.Row.FindControl("lblStatus");

                //Button column
                Control btnControl = e.Row.Cells[3].Controls[0];
                Button  btn        = btnControl as Button;

                ///Normal State
                //if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate)

                CheckBox chkCC  = (CheckBox)e.Row.FindControl("chkCC");
                CheckBox chkPOS = (CheckBox)e.Row.FindControl("chkPOS");
                CheckBox chkLM  = (CheckBox)e.Row.FindControl("chkLM");
                chkCC.Checked  = (PE_DAL.GetTocStatusByRole(lItem.ID, "CC") > 0 ? true : false);
                chkPOS.Checked = (PE_DAL.GetTocStatusByRole(lItem.ID, "POS") > 0 ? true : false);
                chkLM.Checked  = (PE_DAL.GetTocStatusByRole(lItem.ID, "LM") > 0 ? true : false);
                //Edit State
                if ((e.Row.RowState & DataControlRowState.Edit) > 0) //Edit
                {
                    HiddenField hidCustId   = (HiddenField)e.Row.FindControl("hidCustId");
                    TextBox     txtCustType = (TextBox)e.Row.FindControl("txtCustType");

                    hidCustId.Value     = lItem.ID.ToString();
                    txtCustType.Text    = lItem.Name;
                    btn.CommandArgument = hidCustId.Value;
                    if (lItem.Enabled == true)
                    {
                        lblStatus.Text  = "Active";
                        btn.Text        = "Inactivate";
                        btn.CommandName = "MakeInactive";
                    }
                    else
                    {
                        lblStatus.Text  = "Inactive";
                        btn.Text        = "Activate";
                        btn.CommandName = "MakeActive";
                    }
                    #region 3 new checkboxes for the roles
                    chkCC.Enabled  = true;
                    chkPOS.Enabled = true;
                    chkLM.Enabled  = true;
                    #endregion
                }
                else //Normal or Alternate
                {
                    //Find the controls
                    HiddenField hidCustId   = (HiddenField)e.Row.FindControl("hidCustId");
                    Label       lblCustType = (Label)e.Row.FindControl("lblCustType");

                    //assing values to template controls
                    hidCustId.Value     = lItem.ID.ToString();
                    lblCustType.Text    = lItem.Name;
                    btn.CommandArgument = hidCustId.Value;
                    if (lItem.Enabled == true)
                    {
                        lblStatus.Text  = "Active";
                        btn.Text        = "Inactivate";
                        btn.CommandName = "MakeInactive";
                    }
                    else
                    {
                        lblStatus.Text  = "Inactive";
                        btn.Text        = "Activate";
                        btn.CommandName = "MakeActive";
                    }
                    chkCC.Enabled  = false;
                    chkPOS.Enabled = false;
                    chkLM.Enabled  = false;
                }
            }
        }
Example #3
0
        protected void BindValues()
        {
            //If the mode is add, apply the following;
            //else retrieve from DB
            if (Session[PubEntAdminManager.strPubGlobalMode] != null)
            {
                if (Session[PubEntAdminManager.strPubGlobalMode].ToString() == PubEntAdminManager.strPubGlobalAMode)//add
                {
                    this.rdbtnListYesNoEveryOrder.No       = true;
                    this.rdbtnListYesNoShowInSearchRes.Yes = true;
                    //this.ckboxListDisplayStatusExh.IsOrder = true;
                }
                else
                {
                    MultiSelectListBoxItemCollection rcoll = PE_DAL.GetExhDisplayStatusByPubID(this.PubID);
                    foreach (DisplayStatus p in rcoll)
                    {
                        ListItem matchItem = this.ckboxListDisplayStatusExh.Items.FindByValue(p.DisplayStatusID.ToString());
                        if (matchItem != null)
                        {
                            matchItem.Selected = true;
                        }
                    }

                    ExhCollection l = PE_DAL.GetExhInterface(this.PubID);
                    if (l.Count > 0)
                    {
                        Exh l_Exh = l[0];

                        if (l_Exh.EVERYORDER_EXHIBIT > 0)
                        {
                            this.rdbtnListYesNoEveryOrder.Yes = true;
                        }
                        else if (l_Exh.EVERYORDER_EXHIBIT == 0)
                        {
                            this.rdbtnListYesNoEveryOrder.No = true;
                        }

                        //if (!this.rdbtnListYesNoEveryOrder.Selected())
                        //{
                        //    this.rdbtnListYesNoEveryOrder.No = true;
                        //    this.rdbtnListYesNoShowInSearchRes.Yes = true;
                        //}

                        if (l_Exh.ISSEARCHABLE_EXHIBIT > 0)
                        {
                            this.rdbtnListYesNoShowInSearchRes.Yes = true;
                        }
                        else if (l_Exh.ISSEARCHABLE_EXHIBIT == 0)
                        {
                            this.rdbtnListYesNoShowInSearchRes.No = true;
                        }

                        //this.rdbtnListYesNoEveryOrder.Yes = l_Exh.EVERYORDER_EXHIBIT ? true : false;
                        //this.rdbtnListYesNoShowInSearchRes.Yes = l_Exh.ISSEARCHABLE_EXHIBIT ? true : false;

                        this.txtMaxQtyExh.Text  = l_Exh.MAXQTY_EXHIBIT.ToString();
                        this.txtMaxQtyIntl.Text = l_Exh.MAXINTL_EXHIBIT.ToString();
                    }

                    rcoll = PE_DAL.GetKioskConfByPubID(this.PubID);

                    this.listSeledConf.DataSource     = rcoll;
                    this.listSeledConf.DataTextField  = "name";
                    this.listSeledConf.DataValueField = "id";
                    this.listSeledConf.DataBind();


                    MultiSelectListBoxItemCollection lstConfSource = this.listConf.DataSource;
                    foreach (PubEntAdmin.BLL.Conf p in rcoll)
                    {
                        MultiSelectListBoxItem li = new MultiSelectListBoxItem();
                        li.Name = p.ConfName.ToString();
                        li.ID   = p.ConfID;

                        int count = lstConfSource.Count;

                        for (int i = 0; i < count; i++)
                        {
                            MultiSelectListBoxItem item = lstConfSource[i];
                            if (item.Name == li.Name)
                            {
                                lstConfSource.RemoveAt(i);
                                i--;
                                count--;
                            }
                        }
                        li = null;

                        this.txtSeledConf.Text += p.ID + ",";
                    }

                    listConf.DataSource = lstConfSource;
                    listConf.DataBind();

                    MultiSelectListBoxItemCollection rcollR = PE_DAL.GetKioskConfRotateByPubID(this.PubID);
                    this.listRotate.DataSource     = rcollR;
                    this.listRotate.DataTextField  = "name";
                    this.listRotate.DataValueField = "id";
                    this.listRotate.DataBind();
                    foreach (PubEntAdmin.BLL.Conf p in rcollR)
                    {
                        this.txtRotate.Text += p.ID + ",";
                    }
                }
            }
        }