Ejemplo n.º 1
0
        protected void grdUsers_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Save")
                {
                    DropDownList ddlUserRoleF = grdUsers.FooterRow.FindControl("ddlUserRoleF") as DropDownList;
                    TextBox txtUserF = grdUsers.FooterRow.FindControl("txtUserF") as TextBox;

                    //if (IsUserExisiting(txtUserF.Text.ToString().Trim()) == false)
                    //{
                    //    lblerrmsg.Text = "Username does not exists in server membergroup.";
                    //    return;
                    //}

                    int afctrows;
                    objData = new MasterData();
                    TextInfo textInfo = cultureInfo.TextInfo;
                    string domain_username = GetDomainUserName(txtUserF.Text.Trim());
                    afctrows = objData.User_Insert(textInfo.ToTitleCase(txtUserF.Text.Trim()), Convert.ToString(ddlUserRoleF.SelectedItem.Value.Trim()), domain_username);
                    if (afctrows == 101)
                    {
                        lblerrmsg.Text = "User already exists.";
                        return;
                    }
                    grdfill();
                    divmsg.InnerHtml = "Record inserted successfully.";
                    (this.Master as Site1).ClearModifyStatus();
                }

            }
            catch (Exception ex)
            {

                throw ex;
            }
        }