Beispiel #1
0
        public void UpdatePassword()
        {
            bool updated = false;

            byte[] MyPass;
            VSFramework.TripleDES mySecrets = new VSFramework.TripleDES();
            try
            {
                if (Session["mypass"] != "" & Session["mypass"] != null)
                {
                    MyPass = mySecrets.Encrypt(Session["mypass"].ToString());
                    System.Text.StringBuilder newstr = new System.Text.StringBuilder();
                    foreach (byte b in MyPass)
                    {
                        newstr.AppendFormat("{0}, ", b);
                    }
                    string bytepwd = newstr.ToString();
                    int    n       = bytepwd.LastIndexOf(", ");
                    bytepwd = bytepwd.Substring(0, n);
                    updated = VSWebBL.SettingBL.SettingsBL.Ins.UpdateSvalue("Sametime Password 1", bytepwd, VSWeb.Constants.Constants.SysByte);
                }
            }
            catch (Exception ex)
            {
                //6/27/2014 NS added for VSPLUS-634
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }
            try
            {
                if (Session["mypass2"] != "" & Session["mypass2"] != null)
                {
                    MyPass = mySecrets.Encrypt(Session["mypass2"].ToString());
                    System.Text.StringBuilder newstr = new System.Text.StringBuilder();
                    foreach (byte b in MyPass)
                    {
                        newstr.AppendFormat("{0}, ", b);
                    }
                    string bytepwd = newstr.ToString();
                    int    n       = bytepwd.LastIndexOf(", ");
                    bytepwd = bytepwd.Substring(0, n);
                    updated = VSWebBL.SettingBL.SettingsBL.Ins.UpdateSvalue("Sametime Password 2", bytepwd, "System.Byte[]");
                }
            }
            catch (Exception ex)
            {
                //6/27/2014 NS added for VSPLUS-634
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }
        }
Beispiel #2
0
        private Credentials CollectDataForCredentials()
        {
            VSFramework.TripleDES tripleDes = new VSFramework.TripleDES();
            try
            {
                Credentials CredentialsObject = new Credentials();
                CredentialsObject.AliasName = "Exchange-" + LocComboBox.Text;
                CredentialsObject.UserID    = Uid;

                string rawPass               = Pwd;
                byte[] encryptedPass         = tripleDes.Encrypt(rawPass);
                string encryptedPassAsString = string.Join(", ", encryptedPass.Select(s => s.ToString()).ToArray());

                CredentialsObject.Password = encryptedPassAsString;


                return(CredentialsObject);
            }
            catch (Exception ex)
            {
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }
            finally { }
        }
        protected void OKCopy_Click(object sender, EventArgs e)
        {
            bool        check    = false;
            Credentials Csibject = new Credentials();

            Csibject.AliasName = AliasName.Text;

            //DataTable returntable = VSWebBL.ConfiguratorBL.Businesshoursbl.Ins.GetName(Csibject);
            DataTable returntable = VSWebBL.SecurityBL.webspehereImportBL.Ins.GetAliasName(Csibject);
            string    rawpass     = Password.Text;

            byte[] encryptedpass        = encryptkey.Encrypt(rawpass);
            string encryptedpasasstring = string.Join(", ", encryptedpass.Select(s => s.ToString()).ToArray());


            if (returntable.Rows.Count > 0)
            {
                Div3.InnerHtml = "This Alias already exists. Enter another one." +
                                 "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
                Div3.Style.Value = "display: block";
            }
            else
            {
                check = VSWebBL.SecurityBL.webspehereImportBL.Ins.Insertpwd(AliasName.Text, UserID.Text, encryptedpasasstring, 16);
                CopyProfilePopupControl.ShowOnPageLoad = false;

                FillCredentialsComboBox();
            }
        }
Beispiel #4
0
        protected void OK_Click(object sender, EventArgs e)
        {
            bool       check = false;
            LicenseKey lic   = new LicenseKey();

            if (UnitsTextBox.Text != "0")
            {
                lic.Units       = Convert.ToInt32(UnitsTextBox.Text);
                lic.InstallType = InstallTypeList1.SelectedItem.Text;
                lic.CompanyName = CompanyNameComboBox.Text;
                DataTable CompanysIDDataTable = BL.UsersBL.Ins.GetCompanyID(CompanyNameComboBox.Text);
                int       CompanyID           = int.Parse(CompanysIDDataTable.Rows[0]["ID"].ToString());
                lic.LicenseType = LicenseType.SelectedItem.Text;
                if (ExpirationDate.Date != null)
                {
                    if (LicenseType.SelectedItem.Text == "Perpetual")
                    {
                        lic.ExpirationDate = "12/31/9999";
                    }
                    else
                    {
                        DateTime exp = ExpirationDate.Date;
                        lic.ExpirationDate = ExpirationDate.Date.ToString("MM/dd/yyyy");
                        //lic.ExpirationDate = ExpirationDate.Date.ToShortTimeString();
                    }
                }
                else
                {
                    lic.ExpirationDate = null;
                }


                VSFramework.TripleDES tripleDes = new VSFramework.TripleDES();

                string rawPass               = lic.Units + "#" + lic.InstallType + "#" + lic.CompanyName + "#" + LicenseType.SelectedItem.Text + "#" + lic.ExpirationDate;
                byte[] encryptedPass         = tripleDes.Encrypt(rawPass);
                string encryptedPassAsString = string.Join(", ", encryptedPass.Select(s => s.ToString()).ToArray());

                string encrypt = encryptedPassAsString;
                Session["Key"] = encrypt;
                string CreatedBy = Convert.ToString(Session["UserID"]);
                string CreatedOn = DateTime.Now.ToString();
                //int CompanyID = Convert.ToInt32(CompanyNameComboBox.SelectedItem.Value);

                check = BL.LicenseKeyBL.Ins.insert(encrypt, lic.Units, lic.InstallType, lic.LicenseType, lic.ExpirationDate, CreatedBy, CreatedOn, CompanyID);
                Session["LicenseUpdateStatus"] = CompanyNameComboBox.Text;
                Response.Redirect("LicenseGrid.aspx", false);
                Context.ApplicationInstance.CompleteRequest();
            }
            else
            {
                string script = "alert('Units should be Greater than 0');";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", script, true);
            }
        }
Beispiel #5
0
        protected void OKCopy_Click(object sender, EventArgs e)
        {
            bool        check    = false;
            Credentials Csibject = new Credentials();

            Csibject.AliasName = AliasName.Text;
            string rawPass = Password.Text;

            byte[] encryptedPass         = mytestenkey.Encrypt(rawPass);
            string encryptedPassAsString = string.Join(", ", encryptedPass.Select(s => s.ToString()).ToArray());

            //DataTable returntable = VSWebBL.ConfiguratorBL.Businesshoursbl.Ins.GetName(Csibject);
            DataTable returntable = VSWebBL.SecurityBL.webspehereImportBL.Ins.GetAliasName(Csibject);

            if (Session["edit"].ToString() == "true")
            {
                if (returntable.Rows.Count > 0)
                {
                    Div3.InnerHtml = "This Alias already exists. Enter another one." +
                                     "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
                    Div3.Style.Value = "display: block";
                }
                else
                {
                    check = VSWebBL.SecurityBL.webspehereImportBL.Ins.Insertpwd(AliasName.Text, UserID.Text, encryptedPassAsString, 22);
                    Response.Redirect("~/Security/ImportWebsphereServers.aspx?cred=2&CellID=" + Session["CellID"]);
                }
            }
            else
            {
                if (returntable.Rows.Count > 0)
                {
                    Div3.InnerHtml = "This Alias already exists. Enter another one." +
                                     "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
                    Div3.Style.Value = "display: block";
                }
                else
                {
                    check = VSWebBL.SecurityBL.webspehereImportBL.Ins.Insertpwd(AliasName.Text, UserID.Text, encryptedPassAsString, 22);
                    Response.Redirect("~/Security/ImportWebsphereServers.aspx?add=2&webcellid=" + Session["CellID"]);
                }
            }
        }