Exemplo n.º 1
0
        public static string[] GetADUserNames(string prefixText, int count)
        {
            List <string> names = new List <string>();

            try
            {
                int n = 0;
                CWF_Security.SecurityCredentials secCred = new CWF_Security.SecurityCredentials();
                CWF_Corporate.Authentication     AU      = new CWF_Corporate.Authentication(secCred, false);
                List <CWF_Corporate.Profile>     adList  = AU.GetUserProfiles("cn=" + prefixText + "*");
                foreach (CWF_Corporate.Profile p in adList)
                {
                    if (n++ < count)
                    {
                        names.Add(AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(p.friendlyName, p.userName));
                    }
                    else
                    {
                        break;
                    }
                }
                return(names.ToArray());
            }
            catch (Exception ex)
            {
                //Response.Write(ex.Message);
                //Response.End();
                names.Add(AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(prefixText, ""));
                names.Add(AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(ex.Message, ""));
                return(names.ToArray());
            }
        }
Exemplo n.º 2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (txtPWD.Value.Length > 0 && txtUserID.Value.Length > 0)
            {
                CWF_Corporate.Authentication AU = new CWF_Corporate.Authentication(SecCred, false);
                if (AU.ValidateUser(txtUserID.Value, txtPWD.Value))
                {
                    AU.setPortalCookie(txtUserID.Value, Response);
                    Response.Redirect("../default.aspx");
                }
                lblMsg.InnerText = "Sorry, but we were unable to verify your user name!";
                //lbHelp.Visible = true;
            }
            else
            {
                lblMsg.InnerText = "Please enter user name and password!";
            }

            txtPWD.Value = "";
        }
Exemplo n.º 3
0
        public static string updateComment(string stepUserID, string commentToAdd, string BP, string userID, bool usesAD)
        {
            try
            {
                CWF_Security.SecurityCredentials SecCred   = new SecurityCredentials();
                CWF_Corporate.Authentication     AU        = new CWF_Corporate.Authentication(SecCred, usesAD);
                CWF_HelpDesk.Workflow2           workflow2 = new CWF_HelpDesk.Workflow2(SecCred, BP, userID, null, "", 700, usesAD);

                DataTable dtStepUser = workflow2.GetStepUser(stepUserID, false, true);
                if (dtStepUser.Rows.Count > 0)
                {
                    string userName           = userID;
                    CWF_Corporate.Profile pro = AU.GetUserProfile(userID);
                    if (pro.friendlyName.Length > 0)
                    {
                        userName = pro.friendlyName;
                    }

                    string comments = "";
                    string retval   = QA.BaseClass.addComment(ref comments, dtStepUser.Rows[0]["Comments"].ToString(), "");
                    retval += QA.BaseClass.addComment(ref comments, commentToAdd, userName);

                    if (retval.Length == 0)
                    {
                        dtStepUser.Rows[0]["Comments"] = comments;
                        workflow2.updateUsers(dtStepUser, false);
                        return(comments);
                    }
                    else
                    {
                        return(retval);
                    }
                }
                return("Error:No step user record found!");
            }
            catch (Exception ex)
            {
                return("Error:" + ex.Message);
            }
        }