Exemplo n.º 1
0
        protected void ui_gvSearchResults_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            DropDownList ddl = (DropDownList)e.Row.FindControl("ui_ddlAssignedTo");

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                ListItem item = new ListItem(" --- Not Assigned ----", "-1");
                userLogin objUsers = new userLogin();
                objUsers.LoadAll();

                ddl.DataSource = objUsers.DefaultView;
                ddl.DataTextField = userLogin.ColumnNames.UserName;
                ddl.DataValueField = userLogin.ColumnNames.AdminID;
                ddl.DataBind();
                ddl.Items.Insert(0, item);

                HiddenField hd = (HiddenField)e.Row.FindControl("ui_hdnUserID");
                int _userID = -1;
                if (hd.Value != "")
                {
                    _userID = int.Parse(hd.Value);
                }

                ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByValue(_userID.ToString()));
            }
        }
Exemplo n.º 2
0
 protected void ui_btnCheckUser_Click(object sender, EventArgs e)
 {
     userLogin objData = new userLogin();
     if (objData.CheckUser(ui_txtUserName.Text, ui_txtPassword.Text))
     {
         CodeGlobal.LogedInUser = objData;
         Response.Redirect("Home.aspx");
     }
     else
     {
         ui_txtErrorMsg.Text = "Sorry, Wrong UserName or Password";
     }
 }
Exemplo n.º 3
0
        private void BindAssignedUser()
        {
            ListItem item = new ListItem(" --- Select ----", "-1");
            userLogin objCompany = new userLogin();
            objCompany.LoadAll();
            ui_drpAssignedUser.DataSource = objCompany.DefaultView;
            ui_drpAssignedUser.DataTextField = userLogin.ColumnNames.UserName;
            ui_drpAssignedUser.DataValueField = userLogin.ColumnNames.AdminID;
            ui_drpAssignedUser.DataBind();
            ui_drpAssignedUser.Items.Insert(0, item);

            if (CodeGlobal.LogedInUser.Privaledge == "user")
            {
                ui_drpAssignedUser.SelectedValue = CodeGlobal.LogedInUser.s_AdminID;
                ui_drpAssignedUser.Enabled = false;
            }
            else if (CodeGlobal.LogedInUser.Privaledge == "admin")
            {
                ui_drpAssignedUser.SelectedValue = "-1";
                ui_drpAssignedUser.Enabled = true;
            }
        }