예제 #1
0
        protected void btnAdd_Click(Object Sender, EventArgs e)
        {
            int    intUser   = Int32.Parse(Request.Form[hdnUser.UniqueID]);
            string strUser   = oUser.GetName(intUser);
            string strLocal  = "";
            string strDomain = "";
            int    intAdmin  = 0;

            if (panNCB.Visible == true)
            {
                if (chkAdmin.Checked == true)
                {
                    intAdmin = 1;
                }
                else
                {
                    switch (radSysVol.SelectedItem.Value)
                    {
                    case "R":
                        strLocal += "GLCfsaRO_SysVol;";
                        break;

                    case "W":
                        strLocal += "GLCfsaRW_SysVol;";
                        break;

                    case "F":
                        strLocal += "GLCfsaFC_SysVol;";
                        break;
                    }
                    switch (radUtlVol.SelectedItem.Value)
                    {
                    case "R":
                        strLocal += "GLCfsaRO_UtlVol;";
                        break;

                    case "W":
                        strLocal += "GLCfsaRW_UtlVol;";
                        break;

                    case "F":
                        strLocal += "GLCfsaFC_UtlVol;";
                        break;
                    }
                    switch (radAppVol.SelectedItem.Value)
                    {
                    case "R":
                        strLocal += "GLCfsaRO_AppVol;";
                        break;

                    case "W":
                        strLocal += "GLCfsaRW_AppVol;";
                        break;

                    case "F":
                        strLocal += "GLCfsaFC_AppVol;";
                        break;
                    }
                }
                strUser = oUser.GetName(intUser, true);
            }
            if (panPNC.Visible == true)
            {
                if (chkDeveloper.Checked)
                {
                    strDomain += "Developers_" + (chkDeveloperR.Checked ? "1" : "0") + ";";
                }
                if (chkPromoter.Checked)
                {
                    strDomain += "Promoters_" + (chkPromoterR.Checked ? "1" : "0") + ";";
                }
                if (chkAppSupport.Checked)
                {
                    strDomain += "AppSupport_" + (chkAppSupportR.Checked ? "1" : "0") + ";";
                }
                if (chkAppUsers.Checked)
                {
                    strDomain += "AppUsers_" + (chkAppUsersR.Checked ? "1" : "0") + ";";
                }
                //if (chkAuthProbMgmt.Checked)
                //    strDomain += "AuthProbMgmt;";
            }
            bool    boolDuplicate = false;
            DataSet ds            = oServer.GetAccounts(intServer);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                if (dr["xid"].ToString().Trim().ToUpper() == strUser.Trim().ToUpper())
                {
                    boolDuplicate = true;
                    break;
                }
            }
            if (boolDuplicate == false)
            {
                oServer.AddAccount(intServer, strUser, intDomain, intAdmin, strLocal, strDomain, 0);
                Response.Redirect(Request.Path + "?id=" + Request.QueryString["id"] + "&add=true");
            }
            else
            {
                Response.Redirect(Request.Path + "?id=" + Request.QueryString["id"] + "&duplicate=" + strUser);
            }
        }