Пример #1
0
        /// <summary>
        /// Handles the Click event of the ImgLogout control.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.ImageClickEventArgs"/>Instance containing the event data.</param>
        /// <remarks>
        ///  Sequence Diagram:<br/>
        /// <img src="SequenceDiagrams/SD_PrintRoverWeb.MasterPages.InnerPage.ImageLogOff_Click.jpg" />
        /// </remarks>
        protected void ImageLogOff_Click(object sender, ImageClickEventArgs e)
        {
            if (!string.IsNullOrEmpty(Convert.ToString(Session["UserID"], CultureInfo.CurrentCulture)))
            {
                string auditorSuccessMessage = "User " + Convert.ToString(Session["UserID"], CultureInfo.CurrentCulture) + ",LogOut Sucessfully";
                string auditorSource         = HostIP.GetHostIP();

                string messageOwner = Convert.ToString(Session["UserID"], CultureInfo.CurrentCulture);

                ApplicationAuditor.LogManager.RecordMessage(auditorSource, Session["UserID"] as string, ApplicationAuditor.LogManager.MessageType.Success, auditorSuccessMessage);
                Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d);
                Response.Expires         = -1500;
                Response.CacheControl    = "no-cache";
                Session.Abandon();
                Response.Redirect("../Web/LogOn.aspx");
            }
            else
            {
                Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d);
                Response.Expires         = -1500;
                Response.CacheControl    = "no-cache";
                Session.Abandon();
                Response.Redirect("../Web/LogOn.aspx");
            }
        }
Пример #2
0
        /// <summary>
        /// Handles the Click event of the imgTheme control.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.WebControls.CommandEventArgs"/>Instance containing the event data.</param>
        /// <remarks>
        /// Sequence Diagram:<br/>
        ///     <img src="SequenceDiagrams/SD_PrintRoverWeb.Administration.ManageThemes.imgTheme_Click.jpg"/>
        /// </remarks>
        void imgTheme_Click(object sender, CommandEventArgs e)
        {
            string auditorSuccessMessage = "User " + Convert.ToString(Session["UserID"], CultureInfo.CurrentCulture) + ",Themes Updated  Successfully";
            string auditorFailureMessage = "User " + Convert.ToString(Session["UserID"], CultureInfo.CurrentCulture) + ", Failed to Update Themes";
            string auditorSource         = HostIP.GetHostIP();
            string messageOwner          = Convert.ToString(Session["UserID"], CultureInfo.CurrentCulture);
            string themeName             = string.Empty;

            themeName = e.CommandArgument.ToString();
            Session["selectedTheme"] = themeName;
            string themeUpdateResult = DataManager.Controller.Settings.UpdateThemeSettings(themeName);

            if (string.IsNullOrEmpty(themeUpdateResult))
            {
                ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Success, auditorSuccessMessage);
                string LabelTextDialog = Localization.GetLabelText("", Session["selectedCulture"] as string, "SUCCESS");
                ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "showDialog('" + LabelTextDialog + "','Selected Theme Updated Sucessfully','success',10);", true);
            }
            else
            {
                ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Error, auditorFailureMessage);
                string LabelTextDialog = Localization.GetLabelText("", Session["selectedCulture"] as string, "WARNING");
                ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "showDialog('" + LabelTextDialog + "','Under Construction','error',10);", true);
            }
            Response.Redirect("ManageThemes.aspx", true);
        }
        protected void ImageButtonUnLock_Click(object sender, ImageClickEventArgs e)
        {
            string auditMessage      = string.Empty;
            string selectedLanguages = Request.Form["__LANGID"];
            string Status            = "True";
            string auditorSource     = HostIP.GetHostIP();

            if (!string.IsNullOrEmpty(selectedLanguages))
            {
                if (string.IsNullOrEmpty(DataManager.Controller.Users.ManageLanguagesActive(selectedLanguages, Status)))
                {
                    auditMessage = "Language(s) Unlocked successfully";
                    LogManager.RecordMessage(auditorSource, Session["UserID"] as string, LogManager.MessageType.Success, auditMessage);
                    string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "LANGUAGES_RESET_SUCCESS");
                    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Success.ToString(), serverMessage, null);
                }
                else
                {
                    auditMessage = "Failed to Unlock Language(s) ";

                    LogManager.RecordMessage(auditorSource, Session["UserID"] as string, LogManager.MessageType.Success, auditMessage);
                    string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "LANGUAGES_RESET_FAIL");
                    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Success.ToString(), serverMessage, null);
                }
            }
            ProvideLanguageData();
            GetMasterPage().DisplaySupportedLanguages();
        }
        protected void ImageButtonSave_Click(object sender, ImageClickEventArgs e)
        {
            string    auditorSource = HostIP.GetHostIP();
            int       totlaCount    = Convert.ToInt32(HiddenFieldTotalCount.Value);
            Hashtable htSqlQueries  = new Hashtable();

            for (int row = 0; row < totlaCount; row++)
            {
                string isTextChanged = Request.Form["__IsTextChanged_" + row.ToString()];
                if (isTextChanged == "1")
                {
                    string resourceID      = Request.Form["__REC_SLNO_" + row.ToString()];
                    string editableMessage = Request.Form["__EditableMessageControlID_" + row.ToString()];

                    string sqlQuery = "update " + DropDownListType.SelectedValue + " set RESX_VALUE = N'" + editableMessage + "' where RESX_CULTURE_ID ='" + DropDownListLanguage.SelectedValue + "' and REC_SLNO = N'" + resourceID + "'";
                    htSqlQueries.Add(row, sqlQuery);
                }
            }
            if (htSqlQueries.Count > 0)
            {
                DataManager.Controller.Settings.UpdateLocalizedMessages(htSqlQueries);
                HttpContext.Current.Application.Lock();
                Application["APP_LANGUAGES"] = ApplicationSettings.ProvideLanguages();
                HttpContext.Current.Application.UnLock();
            }

            string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "MESSAGE_UPDATED_SUCESSFULLY");

            GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Success.ToString(), serverMessage, null);


            ProvideMesaages();
        }
 private void DeleteCustomWallPaper(string themeName)
 {
     try
     {
         string auditorSource = HostIP.GetHostIP();
         if (!string.IsNullOrEmpty(themeName))
         {
             //Deleting uploaded wall paper in ACM and EAM
             DeleteSelectedWallPaperOverlayImages(themeName);
             string updateSqlResponse = DataManager.Controller.Users.UpdateCustomThemeDetails(themeName);
             if (string.IsNullOrEmpty(updateSqlResponse))
             {
                 Response.Redirect("~/Administration/CustomTheme.aspx");
                 //string auditMessage = "Updated custom Them  to default theme successfully";
                 //LogManager.RecordMessage(auditorSource, Session["UserID"] as string, LogManager.MessageType.Success, auditMessage);
                 //string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "UPDATE_TO_DEFAULT");
                 //GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Success.ToString(), serverMessage, null);
                 //BindCustomImageValues();
                 //return;
             }
             else
             {
                 string auditMessage = "Failed to update custom them to default theme";
                 LogManager.RecordMessage(auditorSource, Session["UserID"] as string, LogManager.MessageType.Error, auditMessage);
                 string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "FAILED_UPDATE_DEFAULT");
                 GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                 BindCustomImageValues();
                 return;
             }
         }
     }
     catch
     {
     }
 }
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        /// <remarks>
        ///  Sequence Diagram:<br/>
        /// <img src="SequenceDiagrams/SD_PrintRoverWeb.Administration.ManageLanguage.Page_Load.jpg" />
        /// </remarks>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Session["UserRole"] as string))
            {
                Response.Redirect("../Web/LogOn.aspx", true);
                return;
            }
            else if (Session["UserRole"] as string != "admin")
            {
                Response.Redirect("~/Administration/UnAuthorisedAccess.aspx");
            }

            if (!IsPostBack)
            {
                auditorSource = HostIP.GetHostIP();
                BinddropdownValues();
                Session["LocalizedData"] = null;
                IBEdit.Attributes.Add("onclick", "return EditDepDetails()");
                ImageButtonLock.Attributes.Add("onclick", "return IsDepSelected()");
                ImageButtonUnLock.Attributes.Add("onclick", "return IsDepSelected()");
                ProvideLanguageData();
                ProvideLanguages();
                ButtonUpdate.Visible = false;
            }
            LocalizeThisPage();

            LinkButton manageLanguages = (LinkButton)Master.FindControl("LinkButtonManageLanguages");

            if (manageLanguages != null)
            {
                manageLanguages.CssClass = "linkButtonSelect_Selected";
            }
        }
        /// <summary>
        /// Updates the cost centers.
        /// </summary>
        /// <remarks></remarks>
        private void UpdateDomainDetails()
        {
            string auditorSuccessMessage = "AD settings updated successfully";
            string auditorSource         = HostIP.GetHostIP();

            bool   isValuesChanged  = false;
            string domainController = TextBoxDomainController.Text.Trim();
            string domainName       = TextBoxDomainName.Text.Trim();
            string domainAlias      = TextBoxDomainAlias.Text.Trim();
            string userName         = TextBoxUserName.Text.Trim();
            string textPassword     = TextBoxPassword.Text.Trim();
            string port             = TextBoxPort.Text.Trim();
            string attribute        = DropDownListFullName.SelectedValue;

            if (oldDomainController != domainController || oldDomainName != domainName || oldDomainUserName != userName || oldDomainUserPassword != textPassword || oldDomainPort != port || oldDomainNameAttribute != attribute || oldDomainAlias != domainAlias)
            {
                isValuesChanged = true;
            }

            if (!isValuesChanged)
            {
                string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "AD_SETTING_UPDATE_SUCCESS");
                GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Success.ToString(), serverMessage.ToString(), null);

                try
                {
                    LogManager.RecordMessage(auditorSource, auditorSource, LogManager.MessageType.Success, auditorSuccessMessage);
                }
                catch (Exception)
                {
                    //
                }
            }
            else
            {
                Dictionary <string, string> dcADSettings = new Dictionary <string, string>();
                dcADSettings.Add("DOMAIN_CONTROLLER", domainController);
                dcADSettings.Add("DOMAIN_NAME", domainName);
                dcADSettings.Add("AD_USERNAME", userName);
                dcADSettings.Add("AD_ALIAS", domainAlias);
                string password = Protector.ProvideEncryptedPassword(textPassword);
                dcADSettings.Add("AD_PASSWORD", password);
                dcADSettings.Add("AD_PORT", port);
                dcADSettings.Add("AD_FULLNAME", DropDownListFullName.SelectedValue);

                if (string.IsNullOrEmpty(DataManager.Controller.Settings.UpdateAcitiveDirectorySettings(dcADSettings, domainName)))
                {
                    string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "AD_SETTING_UPDATE_SUCCESS");
                    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Success.ToString(), serverMessage.ToString(), null);
                }
                else
                {
                    string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "AD_SETTING_UPDATE_FAILED");
                    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage.ToString(), null);
                }
            }
            //string editDomain = Request.Form["__ADNAME"];
            //EditDomainDetails(editDomain);
        }
Пример #8
0
        /// <summary>
        /// Handles the Click event of the ImageButtonDelete control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.ImageClickEventArgs"/> instance containing the event data.</param>
        /// <remarks></remarks>
        protected void ImageButtonDelete_Click(object sender, ImageClickEventArgs e)
        {
            DataSet dsBackupSummary = GetBackupHistory();

            if (dsBackupSummary.Tables[0].Rows.Count == 0)
            {
                GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), "No backup available", null);
            }
            string auditSucessMessage = string.Empty;
            string auditorSource      = HostIP.GetHostIP();
            string pathName           = string.Empty;
            string serverMessage      = Localization.GetServerMessage("", Session["selectedCulture"] as string, "BACKUP_DELETE_SUCCESS");

            auditSucessMessage = serverMessage;
            string auditFailureMessage = string.Empty;
            string spiltBackupDetails  = Request.Form["__BACKUP"] as string;

            if (!string.IsNullOrEmpty(spiltBackupDetails))
            {
                string[] backupDetails = spiltBackupDetails.Split(',');
                pathName = backupDetails[0];
            }
            string backupPath     = ConfigurationManager.AppSettings["backupPath"];
            string restoreSuccess = DataManager.Provider.Settings.ProvideRestore_Backup("Delete", pathName, backupPath, "");

            BuildBackupSummary();
            GetSqlDetails();
            if (restoreSuccess == "Success")
            {
                LogManager.RecordMessage(auditorSource, AUDITORSOURCE, LogManager.MessageType.Success, auditSucessMessage);
                GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Success.ToString(), serverMessage, null);
                //LabelMessage.Text = serverMessage;
            }
            else
            {
                auditFailureMessage = restoreSuccess;
                string[] exMessage = restoreSuccess.Split(",".ToCharArray());
                if (exMessage.Length > 1)
                {
                    serverMessage = exMessage[1].ToString();
                }
                else
                {
                    serverMessage = "Failed to delete Backup";
                }

                LogManager.RecordMessage(auditorSource, AUDITORSOURCE, LogManager.MessageType.Error, auditFailureMessage);
                serverMessage = serverMessage.Replace("'", "");
                GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                //LabelMessage.Visible = true;
                //LabelMessage.Text = restoreSuccess;
            }
        }
        /// <summary>
        /// Discovers the MFPS async completed.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">The <see cref="System.EventArgs"/>Instance containing the event data.</param>
        /// <remarks>
        /// Sequence Diagram:<br/>
        ///     <img src="SequenceDiagrams/SD_PrintRoverWeb.Administration.DiscoverDevices.DiscoverMfpsAsyncCompleted.jpg"/>
        /// </remarks>
        private void DiscoverMfpsAsyncCompleted(object sender, EventArgs e)
        {
            //Set session variable equal to true when process completes
            Session[PROCESS_NAME] = true;
            string auditorSuccessMessage = "Devices discovery completed successfully";
            string auditorSource         = HostIP.GetHostIP();

            if (mfpDiscoverer != null)
            {
                mfpDiscoverer.Dispose();
            }
            LogManager.RecordMessage(auditorSource, AUDITORSOURCE, LogManager.MessageType.Success, auditorSuccessMessage);
        }
Пример #10
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/>Instance containing the event data.</param>
        /// <remarks>
        /// Sequence Diagram:<br/>
        ///     <img src="SequenceDiagrams/SD_PrintRoverWeb.Administration.JobList.Page_Load.jpg"/>
        /// </remarks>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Session["UserRole"] as string))
            {
                Response.Redirect("../Web/LogOn.aspx", true);
                return;
            }

            userSource = Session["UserSource"] as string;
            userRole   = Session["UserRole"] as string;

            if (!IsPostBack)
            {
                string ipAddress = AppLibrary.HostIP.GetHostIP();
                domainName    = AppLibrary.ApplicationSettings.GetDomainName(ipAddress);
                auditorSource = HostIP.GetHostIP();
                GetUserSource();
                GetDomainList();
                GetUsers();
                GetJobList();
                GetMFPs();
                DisplayReleaseStation();
                GetPreferredCsotCenter();
                Session["LocalizedData"] = null;
            }

            if (userRole.ToLower() == "user")
            {
                //divUserSource.Visible = false;
                tabelCellLabelUserSource.Visible = false;
                TableCell1.Visible = false;
                //TableCell2.Visible = false;
                // TableCell7.Visible = false;
                TableCell10.Visible = false;
            }

            ImageButtonDelete.Attributes.Add("onclick", "return DeleteJobs()");
            LocalizeThisPage();
            LinkButton managePrintJobs = (LinkButton)Master.FindControl("LinkButtonPrintJobs");

            if (managePrintJobs != null)
            {
                managePrintJobs.CssClass = "linkButtonSelect";
            }
            if (recordsCount == 0)
            {
                TableCellDelete.Visible = false;
                //ISplit.Visible = false;
                //TableCell7.Visible = false;
            }
        }
        protected void ButtonUpdateUserAccount_Click(object sender, EventArgs e)
        {
            string auditorSuccessMessage = "Email settings updated successfully by '" + Session["UserID"].ToString() + "' ";
            string auditorFailureMessage = "Failed to update Email settings";
            string auditorSource         = HostIP.GetHostIP();
            string suggestionMessage     = "Report to administrator";

            try
            {
                string usreAccountType = DropDownListUserAccountExpiry.SelectedItem.Value;
                string days            = "0";
                string hours           = "0";
                string minutes         = "0";
                string expiraryValue   = string.Empty;

                if (!string.IsNullOrEmpty(TextboxDays.Text.Trim()))
                {
                    days = TextboxDays.Text.Trim();
                }
                if (!string.IsNullOrEmpty(TextboxHours.Text.Trim()))
                {
                    hours = TextboxHours.Text.Trim();
                }
                if (!string.IsNullOrEmpty(TextboxMinutes.Text.Trim()))
                {
                    minutes = TextboxMinutes.Text.Trim();
                }

                expiraryValue += days + ":" + hours + ":" + minutes;

                string updateResult = DataManager.Controller.Settings.UpdateUserAccountSettingsSettings(usreAccountType, expiraryValue);
                if (string.IsNullOrEmpty(updateResult))
                {
                    LogManager.RecordMessage(auditorSource, AUDITORSOURCE, LogManager.MessageType.Success, auditorSuccessMessage);
                    string serverMessage = "Successfully updated anonymous user account settings"; //Localization.GetServerMessage("", Session["selectedCulture"] as string, "MFP_UPDATE_SUCCESS");
                    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Success.ToString(), serverMessage, null);
                }
                else
                {
                    LogManager.RecordMessage(auditorSource, AUDITORSOURCE, LogManager.MessageType.Error, auditorFailureMessage);
                    string serverMessage = "Failed to update anonymous user account settings"; //Localization.GetServerMessage("", Session["selectedCulture"] as string, "MFP_ADD_FAIL");
                    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                }
            }
            catch (Exception ex)
            {
            }
            BindEmailSettings();
        }
        /// <summary>
        /// Gets the job configuration.
        /// </summary>
        /// <returns>TimeSpan</returns>
        /// <remarks>
        /// Sequence Diagram:<br/>
        ///     <img src="SequenceDiagrams/SD_PrintDataProvider.FileServerPrintProvider.GetJobConfig.jpg"/>
        /// </remarks>
        private static TimeSpan GetJobConfig()
        {
            string   auditsource = HostIP.GetHostIP();
            string   timeSpan    = "36000";
            TimeSpan tsRet       = TimeSpan.Parse(timeSpan);

            try
            {
                string jobRetaintionDays = string.Empty;
                string jobRetaintionTime = string.Empty;
                string jobConfiguration  = string.Empty;

                try
                {
                    AccountingPlusAdministration.AccountingConfiguratorSoapClient administrationWeb = new AccountingPlusAdministration.AccountingConfiguratorSoapClient();

                    jobConfiguration = administrationWeb.JobConfiguration();
                }
                catch (Exception ex)
                {
                    jobConfiguration = ConfigurationManager.AppSettings["JOBCONFIGURATION"].ToString();
                }
                string[] jobConfig = jobConfiguration.Split(",".ToCharArray());
                jobRetaintionDays = jobConfig[0];
                jobRetaintionTime = jobConfig[1];

                string[] jobTime = jobRetaintionTime.Split(":".ToCharArray());

                tsRet = new TimeSpan(Convert.ToInt32(jobRetaintionDays, CultureInfo.InvariantCulture), Convert.ToInt32(jobTime[0].ToString(), CultureInfo.InvariantCulture), Convert.ToInt32(jobTime[1].ToString(), CultureInfo.InvariantCulture), 0);
            }
            catch (IOException)
            {
            }
            catch (NullReferenceException)
            {
            }
            catch (DataException)
            {
            }
            return(tsRet);
        }
        protected void BtnUpdate_Click(object sender, EventArgs e)
        {
            string auditorSuccessMessage = "Email settings updated successfully by '" + Session["UserID"].ToString() + "' ";
            string auditorFailureMessage = "Failed to update Email settings";
            string auditorSource         = HostIP.GetHostIP();
            string suggestionMessage     = "Report to administrator";


            try
            {
                string sendCredentialsto = DropDownListSender.SelectedItem.Value;
                string emailTO           = TextboxEmailTo.Text.Trim();
                string emailCC           = TextboxCC.Text.Trim();
                string emailBCC          = TextboxBCC.Text.Trim();
                string subject           = TextboxSubject.Text.Trim();
                string body      = HTMLEditorContextBody.Content;
                string signature = HTMLEditorContextSignature.Content;


                string updateResult = DataManager.Controller.Settings.UpdateEmailSenderSettings(sendCredentialsto, emailTO, emailCC, emailBCC, subject, body, signature);
                if (string.IsNullOrEmpty(updateResult))
                {
                    LogManager.RecordMessage(auditorSource, AUDITORSOURCE, LogManager.MessageType.Success, auditorSuccessMessage);
                    string serverMessage = "Successfully updated email settings"; //Localization.GetServerMessage("", Session["selectedCulture"] as string, "MFP_UPDATE_SUCCESS");
                    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Success.ToString(), serverMessage, null);
                }
                else
                {
                    LogManager.RecordMessage(auditorSource, AUDITORSOURCE, LogManager.MessageType.Error, auditorFailureMessage);
                    string serverMessage = "Failed to update email settings"; //Localization.GetServerMessage("", Session["selectedCulture"] as string, "MFP_ADD_FAIL");
                    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                }
            }
            catch (Exception ex)
            {
                LogManager.RecordMessage(auditorSource, AUDITORSOURCE, LogManager.MessageType.Error, auditorFailureMessage);
                string serverMessage = "Failed to update email settings"; //Localization.GetServerMessage("", Session["selectedCulture"] as string, "MFP_ADD_FAIL");
                GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
            }
            BindEmailSettings();
        }
Пример #14
0
        /// <summary>
        /// Handles the Click event of the ButtonIgnoreDuplicatesSave control.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/>Instance containing the event data.</param>
        /// <remarks>
        /// Sequence Diagram:<br/>
        ///     <img src="SequenceDiagrams/SD_PrintRoverWeb.Administration.ManageDBUploadUsers.ButtonIgnoreDuplicatesSave_Click.jpg"/>
        /// </remarks>
        protected void ButtonIgnoreDuplicatesSave_Click(object sender, EventArgs e)
        {
            string    auditorSuccessMessage = "User " + Convert.ToString(Session["UserID"], CultureInfo.CurrentCulture) + ",DB users imported successfully";
            string    auditorFailureMessage = "User " + Convert.ToString(Session["UserID"], CultureInfo.CurrentCulture) + ",Failed to Insert DB Users";
            string    auditorSource         = HostIP.GetHostIP();
            string    messageOwner          = Convert.ToString(Session["UserID"], CultureInfo.CurrentCulture);
            DataTable dtIgnore = new DataTable();

            dtIgnore = (DataTable)Session["CsvInsertRecords"];
            if (dtIgnore.Rows.Count > 0)
            {
                string tableName         = "dbo.TEMP_CARD_MAPPING";
                string str_InsertCSVData = DataManager.Controller.Users.UpdateManageUserCards(dtIgnore, tableName);

                if (string.IsNullOrEmpty(str_InsertCSVData))
                {
                    LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Success, auditorSuccessMessage);
                    string serverMessage   = "User Card/Pin Mapped Sucessfully"; //Localization.GetServerMessage("", Session["selectedCulture"] as string, "INSERT_SUCESS");
                    string LabelTextDialog = Localization.GetLabelText("", Session["selectedCulture"] as string, "SUCCESS");
                    ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "jSuccess('" + serverMessage + "');", true);
                    return;
                }
                else
                {
                    LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Warning, auditorFailureMessage);
                    string serverMessage   = "Failed To Map User Card/Pin"; // Localization.GetServerMessage("", Session["selectedCulture"] as string, "INSERT_FAILED");
                    string LabelTextDialog = Localization.GetLabelText("", Session["selectedCulture"] as string, "ERROR");
                    ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "jError('" + serverMessage + "');", true);
                    return;
                }
            }
            else
            {
                LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Warning, auditorFailureMessage);
                string serverMessage   = Localization.GetServerMessage("", Session["selectedCulture"] as string, "NORECORDS_EXISTS");
                string LabelTextDialog = Localization.GetLabelText("", Session["selectedCulture"] as string, "ERROR");
                ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "jError('" + serverMessage + "');", true);
                return;
            }
        }
Пример #15
0
        private void RestoreBackup(out string auditSucessMessage, out string auditorSource, out string serverMessage, out string auditFailureMessage, out string pathName, out string backupPath, out string backupDestinationpath, out string serverName, out string userName, out string password)
        {
            TableRowSQLCreditinals.Visible        = false;
            TableRowSQLCreditinalsButtons.Visible = false;
            auditSucessMessage    = string.Empty;
            auditorSource         = HostIP.GetHostIP();
            serverMessage         = Localization.GetServerMessage("", Session["selectedCulture"] as string, "RESTORE_SUCCESS");
            auditFailureMessage   = string.Empty;
            auditSucessMessage    = serverMessage;
            pathName              = restorePath;
            backupPath            = ConfigurationManager.AppSettings["backupPath"];
            backupDestinationpath = TextBoxDestination.Text;
            string connectionString = ConfigurationManager.AppSettings["DBConnection"];

            string[] ConnectionSpilt = connectionString.Split(';');
            string[] serverSpilt     = ConnectionSpilt[0].Split('=');
            serverName = serverSpilt[1].ToString();
            userName   = DataManager.Controller.FormatData.FormatSingleQuot(TextBoxUser.Text);
            password   = DataManager.Controller.FormatData.FormatSingleQuot(TextBoxPass.Text);
            if (string.IsNullOrEmpty(password))
            {
                password = sqlPassword;
            }
        }
        private void SaveCardDataConfigurationSettings()
        {
            Page.Header.Title = Localization.GetLabelText("", Session["selectedCulture"] as string, "PRINT_RELEASE");
            string auditorSuccessMessage = "User " + Convert.ToString(Session["UserID"], CultureInfo.CurrentCulture) + ", Card configuration updated Successfully";
            string auditorFailureMessage = "User " + Convert.ToString(Session["UserID"], CultureInfo.CurrentCulture) + " ,Failed to Update Card Settings";
            string auditorWarningMessage = "User " + Convert.ToString(Session["UserID"], CultureInfo.CurrentCulture) + " ,Invalid Settings in Card configuration";
            string auditorSource         = HostIP.GetHostIP();
            string messageOwner          = Convert.ToString(Session["UserID"], CultureInfo.CurrentCulture);

            DataTable dataTableCardSettings = new DataTable();

            dataTableCardSettings.Columns.Add("CARD_TYPE", typeof(string));
            dataTableCardSettings.Columns.Add("CARD_RULE", typeof(string));
            dataTableCardSettings.Columns.Add("CARD_SUB_RULE", typeof(string));

            dataTableCardSettings.Columns.Add("CARD_DATA_ENABLED", typeof(bool));
            dataTableCardSettings.Columns.Add("CARD_DATA_ON", typeof(string));
            dataTableCardSettings.Columns.Add("CARD_POSITION_START", typeof(int));
            dataTableCardSettings.Columns.Add("CARD_POSITION_LENGTH", typeof(int));

            dataTableCardSettings.Columns.Add("CARD_DELIMETER_START", typeof(string));
            dataTableCardSettings.Columns.Add("CARD_DELIMETER_END", typeof(string));

            dataTableCardSettings.Columns.Add("CARD_CODE_VALUE", typeof(string));
            string cardType = DropDownListCardType.SelectedValue;

            string cardRule    = "FSC";
            string cardSubRule = "-";

            bool   isValidSettings    = true;
            string cardSettingEnabled = string.Empty;
            string cardRuleOn         = string.Empty;
            string startPositionText  = string.Empty;
            string stringWidthText    = string.Empty;
            string startDelimeter     = string.Empty;
            string endDelimeter       = string.Empty;
            string fscCheckValue      = string.Empty;
            bool   enableRule         = CheckBoxEnableFsc.Checked;
            int    startPosition      = 0;
            int    stringWidth        = 0;

            // Get FSC Settings
            dataTableCardSettings.Rows.Add(cardType, cardRule, cardSubRule, enableRule, cardRuleOn, startPosition, stringWidth, startDelimeter, endDelimeter, fscCheckValue);

            for (int setting = 1; setting <= TOTALFSCSETTINGS; setting++)
            {
                cardSubRule        = setting.ToString();
                cardSettingEnabled = Request.Form["FSC_ENABLERULE_" + setting];
                cardRuleOn         = Request.Form["FSC_RULEON_" + setting];
                startPositionText  = Request.Form["FSC_START_POSITION_" + setting];
                stringWidthText    = Request.Form["FSC_LENGTH_" + setting];
                startDelimeter     = Request.Form["FSC_START_DELIMETER_" + setting];
                endDelimeter       = Request.Form["FSC_END_DELIMETER_" + setting];
                fscCheckValue      = Request.Form["FSC_CHECK_VALUE_" + setting];

                //Calculating By position Validations
                if (cardRuleOn == "P" && CheckBoxEnableFsc.Checked == true && cardSettingEnabled == "1")
                {
                    string widthValue         = stringWidthText;
                    string startPositionValue = startPositionText;
                    if (string.IsNullOrEmpty(widthValue) || string.IsNullOrEmpty(startPositionValue) || string.IsNullOrEmpty(fscCheckValue) || widthValue.Substring(0) == "0" || startPositionValue.Substring(0) == "0")
                    {
                        isValidSettings = false;
                    }
                    try
                    {
                        if (Convert.ToInt32(widthValue) != Convert.ToInt32(fscCheckValue.Length))
                        {
                            isValidSettings = false;
                        }
                    }
                    catch (Exception ex)
                    {
                        isValidSettings = false;
                    }
                }
                //Calculating By delimiter Validations
                if (cardRuleOn == "D" && CheckBoxEnableFsc.Checked == true && cardSettingEnabled == "1")
                {
                    string startDelimiterValue = startDelimeter;
                    string endDelimiterValue   = endDelimeter;
                    if (string.IsNullOrEmpty(startDelimiterValue) || string.IsNullOrEmpty(endDelimiterValue) || string.IsNullOrEmpty(fscCheckValue))
                    {
                        isValidSettings = false;
                    }
                }

                if (!string.IsNullOrEmpty(startPositionText))
                {
                    try
                    {
                        startPosition = int.Parse(startPositionText);
                    }
                    catch
                    {
                        startPosition = 0;
                    }
                }
                else
                {
                    startPosition = 0;
                }

                if (!string.IsNullOrEmpty(stringWidthText))
                {
                    try
                    {
                        stringWidth = int.Parse(stringWidthText);
                    }
                    catch
                    {
                        stringWidth = 0;
                    }
                }
                else
                {
                    stringWidth = 0;
                }
                if (!string.IsNullOrEmpty(cardSettingEnabled))
                {
                    enableRule = true;
                }
                else
                {
                    enableRule = false;
                }

                dataTableCardSettings.Rows.Add(cardType, cardRule, cardSubRule, enableRule, cardRuleOn, startPosition, stringWidth, startDelimeter, endDelimeter, fscCheckValue);
            }

            // Get All card Settings

            // DPR
            cardType           = "-1";
            cardRule           = "DDR";
            cardSubRule        = "-";
            cardSettingEnabled = Request.Form["DDR_ENABLERULE"];
            cardRuleOn         = Request.Form["DDR_RULEON"];
            startPositionText  = Request.Form["DDR_START_POSITION"];
            stringWidthText    = Request.Form["DDR_LENGTH"];
            startDelimeter     = Request.Form["DDR_START_DELIMETER"];
            endDelimeter       = Request.Form["DDR_END_DELIMETER"];
            fscCheckValue      = "";
            if (!string.IsNullOrEmpty(startPositionText))
            {
                try
                {
                    startPosition = int.Parse(startPositionText);
                }
                catch
                {
                    startPosition = 0;
                }
            }

            if (!string.IsNullOrEmpty(stringWidthText))
            {
                try
                {
                    stringWidth = int.Parse(stringWidthText);
                }
                catch
                {
                    stringWidth = 0;
                }
            }
            if (!string.IsNullOrEmpty(cardSettingEnabled))
            {
                enableRule = true;
            }
            else
            {
                enableRule = false;
            }

            if (cardSettingEnabled != null && cardRuleOn == "P")
            {
                if (startPositionText.Substring(0) == "0" || stringWidthText.Substring(0) == "0" || string.IsNullOrEmpty(startPositionText) || string.IsNullOrEmpty(stringWidthText))
                {
                    isValidSettings = false;
                }
            }
            if (cardSettingEnabled != null && cardRuleOn == "D")
            {
                if (string.IsNullOrEmpty(startDelimeter) || string.IsNullOrEmpty(endDelimeter))
                {
                    isValidSettings = false;
                }
            }
            dataTableCardSettings.Rows.Add(cardType, cardRule, cardSubRule, enableRule, cardRuleOn, startPosition, stringWidth, startDelimeter, endDelimeter, fscCheckValue);

            // DPR
            cardType           = "-1";
            cardRule           = "DPR";
            cardSubRule        = "-";
            cardSettingEnabled = Request.Form["DPR_ENABLERULE"];
            cardRuleOn         = "";
            startPositionText  = "0";
            stringWidthText    = "0";
            startDelimeter     = Request.Form["DPR_PRE_PADDING"];
            endDelimeter       = Request.Form["DPR_POST_PADDING"];
            fscCheckValue      = "";
            startPosition      = 0;
            stringWidth        = 0;
            if (!string.IsNullOrEmpty(cardSettingEnabled))
            {
                enableRule = true;
            }
            else
            {
                enableRule = false;
            }

            dataTableCardSettings.Rows.Add(cardType, cardRule, cardSubRule, enableRule, cardRuleOn, startPosition, stringWidth, startDelimeter, endDelimeter, fscCheckValue);
            string UpdateStatus = string.Empty;

            if (isValidSettings == true)
            {
                UpdateStatus = DataManager.Controller.Card.UpdateCardSettings(DropDownListCardType.SelectedValue, dataTableCardSettings);
                if (string.IsNullOrEmpty(UpdateStatus))
                {
                    ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Success, auditorSuccessMessage);
                    string serverMessage   = Localization.GetServerMessage("", Session["selectedCulture"] as string, "CARD_UPDATE_SUCESS");
                    string LabelTextDialog = Localization.GetLabelText("", Session["selectedCulture"] as string, "SUCCESS");
                    ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "jSuccess('" + serverMessage + "');", true);
                }
                else
                {
                    ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Error, auditorFailureMessage);
                    string serverMessage   = Localization.GetServerMessage("", Session["selectedCulture"] as string, "CARD_UPDATE_FAIL");
                    string LabelTextDialog = Localization.GetLabelText("", Session["selectedCulture"] as string, "ERROR");
                    ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "jError('" + serverMessage + "');", true);
                }
                DisplayCardSettings();
            }
            else
            {
                UpdateStatus = DataManager.Controller.Card.UpdateInvalidCardSettings(DropDownListCardType.SelectedValue, dataTableCardSettings);
                if (string.IsNullOrEmpty(UpdateStatus))
                {
                    ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Error, auditorWarningMessage);
                    string serverMessage   = Localization.GetServerMessage("", Session["selectedCulture"] as string, "INVALID_SETTINGS");
                    string LabelTextDialog = Localization.GetLabelText("", Session["selectedCulture"] as string, "ERROR");
                    ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "jError('" + serverMessage + "');", true);
                }
                else
                {
                    ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Error, auditorFailureMessage);
                    string serverMessage   = Localization.GetServerMessage("", Session["selectedCulture"] as string, "CARD_UPDATE_FAIL");
                    string LabelTextDialog = Localization.GetLabelText("", Session["selectedCulture"] as string, "ERROR");
                    ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "jError('" + serverMessage + "');", true);
                }
                DisplayInvalidCardSettings();
            }
        }
Пример #17
0
        /// <summary>
        /// Handles the Click event of the btn_Adduser control.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/>Instance containing the event data.</param>
        /// <remarks>
        /// Sequence Diagram:<br/>
        ///     <img src="SequenceDiagrams/SD_PrintRoverWeb.Web.FirstLogOn.ButtonAddUser_Click.jpg"/>
        /// </remarks>
        protected void ButtonAddUser_Click(object sender, EventArgs e)
        {
            string  auditorSuccessMessage = TextBoxUserId.Text + " ,Registered Sucessfully";
            string  auditorFailureMessage = TextBoxUserId.Text + ", Registration Failed";
            string  auditorSource         = HostIP.GetHostIP();
            string  selectedUserSource    = DropDownListUserSource.SelectedItem.Value.ToString();
            string  messageOwner          = TextBoxUserId.Text;
            string  domainName            = TextBoxDomainName.Text.Trim();
            string  userId                = TextBoxUserId.Text.Trim();
            string  userPassword          = TextBoxUserPassword.Text.Trim();
            string  manageAdmin           = "0";
            string  userAccountIdInDb     = string.Empty;
            string  userName              = string.Empty;
            string  userEmail             = string.Empty;
            string  userRole              = string.Empty;
            string  authenticationServer  = string.Empty;
            string  department            = ApplicationSettings.ProvideDefaultDepartment(selectedUserSource);
            bool    isValidUser           = false;
            bool    isUserExistInDatabase = false;
            DataSet userDetails           = null;
            DataSet dsManageFirstLogOn    = new DataSet();

            dsManageFirstLogOn.Locale = CultureInfo.InvariantCulture;
            Session["UserSource"]     = selectedUserSource.ToString();
            try
            {
                //if (userId.ToLower() != "admin" && userId.ToLower() != "administrator")
                //{

                isValidUser = AppAuthentication.IsValidUser(selectedUserSource, userId, userPassword, domainName, ref isUserExistInDatabase, true, ref userDetails);
                if (selectedUserSource == Constants.USER_SOURCE_DB)
                {
                    authenticationServer = "Local";
                    isValidUser          = true;
                }
                else
                {
                    if (isValidUser == true && userDetails != null)
                    {
                        if (userDetails.Tables[1].Rows.Count > 0)
                        {
                            isValidUser = true;
                            DataRow[] drManageFirstLogOn = userDetails.Tables[1].Select("USER_ID='" + userId + "'");
                            userName             = drManageFirstLogOn[0].ItemArray[2].ToString() + "," + drManageFirstLogOn[0].ItemArray[3].ToString();
                            userEmail            = drManageFirstLogOn[0].ItemArray[4].ToString();
                            authenticationServer = TextBoxDomainName.Text.Trim();
                        }
                        else
                        {
                            isValidUser = false;
                        }
                    }
                }
                if (isValidUser)
                {
                    manageAdmin = DataManager.Provider.Users.ManageFirstLogOn(userId, userPassword, domainName, userName, userEmail, selectedUserSource, department, authenticationServer);
                    string assignUser = DataManager.Controller.Users.AssignUserToCostCenter(userId, "1", userSource);
                    if (string.IsNullOrEmpty(manageAdmin))
                    {
                        ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Success, auditorSuccessMessage);
                        DataSet dsValidUser = DataManager.Provider.Users.ProvideUserDetails(userId, selectedUserSource);
                        if (dsValidUser.Tables[0].Rows.Count > 0)
                        {
                            if (Convert.ToString(dsValidUser.Tables[0].Rows[0]["REC_ACTIVE"], CultureInfo.CurrentCulture) == "True")
                            {
                                userAccountIdInDb = Convert.ToString(dsValidUser.Tables[0].Rows[0]["USR_ACCOUNT_ID"], CultureInfo.CurrentCulture);
                                userName          = Convert.ToString(dsValidUser.Tables[0].Rows[0]["USR_NAME"], CultureInfo.CurrentCulture);
                                userRole          = Convert.ToString(dsValidUser.Tables[0].Rows[0]["USR_ROLE"], CultureInfo.CurrentCulture);
                            }
                            else
                            {
                                ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Error, auditorFailureMessage);
                                string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USER_LOGIN_DISABLE_ERROR");
                                GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                                DisplayUserControls();
                                return;
                            }
                        }
                        else
                        {
                            ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Error, auditorFailureMessage);
                            string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USER_REG_ERROR");
                            GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                            DisplayUserControls();
                            return;
                        }
                    }
                    else
                    {
                        ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Error, auditorFailureMessage);
                        string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USER_REG_ERROR");
                        GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                        DisplayUserControls();
                        return;
                    }
                }
                else
                {
                    ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Error, auditorFailureMessage);
                    string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USER_REG_ERROR");
                    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                    DisplayUserControls();
                    return;
                }
                // }
                //else
                //{
                //    ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Warning, auditorFailureMessage);
                //    string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USER_ADMIN_ERROR");
                //    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Warning.ToString(), serverMessage, null);
                //    DisplayUserControls();
                //    return;

                //}
            }
            catch (Exception ex)
            {
                ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Error, auditorFailureMessage);
                string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USER_REG_ERROR");
                GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                DisplayUserControls();
                return;
            }

            if (string.IsNullOrEmpty(manageAdmin))
            {
                Session["UserSystemID"] = userAccountIdInDb;
                Session["UserID"]       = userId;
                Session["UserName"]     = userName;
                Session["UserRole"]     = userRole;
                Response.Redirect("~/Administration/ManageUsers.aspx");
            }
            else
            {
                ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Error, auditorFailureMessage);
                string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USER_REG_ERROR");
                GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                DisplayUserControls();
            }
        }
Пример #18
0
        protected void ImageBackupOk_Click(object sender, EventArgs e)
        {
            string auditSucessMessage = string.Empty;
            string auditorSource      = HostIP.GetHostIP();
            string serverMessage      = Localization.GetServerMessage("", Session["selectedCulture"] as string, "BACKUP_SUCCESS_ON") + DateTime.Now.ToShortDateString();

            auditSucessMessage = serverMessage;
            string auditFailureMessage = "Failed to Backup server on " + DateTime.Now.ToShortDateString();
            //string backupPath = ConfigurationManager.AppSettings["backupPath"];
            string backupdestinationpath = TextBoxDestination.Text;
            string path             = Server.MapPath("~/");
            string userSpecificName = DataManager.Controller.FormatData.FormatSingleQuot(TextBoxFileName.Text);

            if (Directory.Exists(path))
            {
                string restoreSuccess = DataManager.Provider.Settings.ProvideRestore_Backup("Backup", "", backupdestinationpath, userSpecificName);
                if (restoreSuccess == "Success")
                {
                    LogManager.RecordMessage(auditorSource, AUDITORSOURCE, LogManager.MessageType.Success, auditSucessMessage);
                    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Success.ToString(), serverMessage, null);
                    //LabelMessage.Text = Localization.GetServerMessage("", Session["selectedCulture"] as string, "BACKUP_SUCCESS");
                    TableSummary.Visible             = true;
                    TableBackUpDetails.Visible       = true;
                    TablerowBackupName.Visible       = false;
                    TablerowBackupNameButton.Visible = false;
                    BuildBackupSummary();
                    GetSqlDetails();
                }
                else
                {
                    LogManager.RecordMessage(auditorSource, AUDITORSOURCE, LogManager.MessageType.Error, auditFailureMessage);
                    serverMessage = "Failed to backup server/Path does not exists";
                    serverMessage = serverMessage.Replace("'", "");
                    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                    //LabelMessage.Visible = true;
                    //LabelMessage.Text = restoreSuccess;
                    TableSummary.Visible             = true;
                    TableBackUpDetails.Visible       = true;
                    TablerowBackupName.Visible       = false;
                    TablerowBackupNameButton.Visible = false;
                    BuildBackupSummary();
                    GetSqlDetails();
                }
            }
            else
            {
                //Directory.CreateDirectory(backupdestinationpath);
                LogManager.RecordMessage(auditorSource, AUDITORSOURCE, LogManager.MessageType.Error, auditFailureMessage);
                serverMessage = "Path does not exists";
                serverMessage = serverMessage.Replace("'", "");
                GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                //LabelMessage.Visible = true;
                //LabelMessage.Text = restoreSuccess;
                TableSummary.Visible             = true;
                TableBackUpDetails.Visible       = true;
                TablerowBackupName.Visible       = false;
                TablerowBackupNameButton.Visible = false;
                BuildBackupSummary();
                GetSqlDetails();
            }
        }
Пример #19
0
        /// <summary>
        /// Handles the Click event of the btn_Upload control.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/>Instance containing the event data.</param>
        /// <remarks>
        /// Sequence Diagram:<br/>
        ///     <img src="SequenceDiagrams/SD_PrintRoverWeb.Administration.ManageDBUploadUsers.ButtonUpload_Click.jpg"/>
        /// </remarks>
        protected void ButtonUpload_Click(object sender, EventArgs e)
        {
            string auditorFailureMessage = "User " + Convert.ToString(Session["UserID"], CultureInfo.CurrentCulture) + ", Failed to Upload File";
            string auditorSource         = HostIP.GetHostIP();
            string messageOwner          = Convert.ToString(Session["UserID"], CultureInfo.CurrentCulture);

            ButtonIgnoreDuplicatesSave.Visible = false;
            ButtonInsert.Visible = true;
            //ButtonPreview.Visible = true;
            divDuplicateRecordsPanel.Visible = false;
            ViewState["FileName"]            = string.Empty;
            divPreviewUsers.Visible          = false;
            if (string.IsNullOrEmpty(FileUpload1.PostedFile.FileName))
            {
                tdShowUploadUsers.Visible = false;
                ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Warning, auditorFailureMessage);
                string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "SELECT_FILE");
                GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Warning.ToString(), serverMessage.ToString(), null);
            }
            else
            {
                //save the file
                //restrict user to upload other file extenstion
                string[] FileExt = FileUpload1.FileName.Split('.');
                string   FileEx  = FileExt[FileExt.Length - 1];
                if (FileEx.ToLower(CultureInfo.CurrentCulture) == "csv")
                {
                    try
                    {
                        if (FileEx.ToLower(CultureInfo.CurrentCulture) == "csv")
                        {
                            ViewState["FileName"] = "csv";
                            // create object for CsvReader and pass the stream
                            CsvReader reader = new CsvReader(FileUpload1.PostedFile.InputStream, Encoding.Default);
                            //get the header
                            string[] headers = reader.GetCsvLine();
                            if (headers != null && headers.Length != 0)
                            {
                                DataTable dt = new DataTable();
                                dt.Locale = CultureInfo.InvariantCulture;
                                //add headers
                                foreach (string strHeader in headers)
                                {
                                    dt.Columns.Add(strHeader);
                                }

                                string[] data;
                                while ((data = reader.GetCsvLine()) != null)
                                {
                                    dt.Rows.Add(data);
                                }
                                //bind gridview  ;
                                Session["csvFileData"] = dt;

                                if (dt.Rows.Count > 0)
                                {
                                    if (dt.Rows.Count <= 10000)
                                    {
                                        tdShowUploadUsers.Visible = true;
                                        if (dt.Rows.Count <= 5)
                                        {
                                            GridUploadedUsers.DataSource = dt;
                                            GridUploadedUsers.DataBind();
                                            GridUploadedUsers.Attributes.Add("style", "text-align:left;margin-left:1px;");
                                            GridUploadedUsers.HeaderRow.Attributes.Add("style", "text-align:left");
                                        }
                                        else
                                        {
                                            DataTable dtTopFiveRecords = new DataTable();
                                            dtTopFiveRecords.Locale      = CultureInfo.InvariantCulture;
                                            dtTopFiveRecords             = GetNRecords(5, dt);
                                            GridUploadedUsers.DataSource = dtTopFiveRecords;
                                            GridUploadedUsers.DataBind();
                                            GridUploadedUsers.Attributes.Add("style", "text-align:left;margin-left:1px;");
                                            GridUploadedUsers.HeaderRow.Attributes.Add("style", "text-align:left");
                                        }
                                        labelTotalUsers.Text = Convert.ToString(dt.Rows.Count, CultureInfo.CurrentCulture);
                                        int TotalItems = 0;
                                        listCSVColumns.Items.Clear();
                                        //Bind CSV Columns to LisTextBoxox
                                        if (listManageUsers.Items.Count <= dt.Columns.Count)
                                        {
                                            for (int i = 0; i < dt.Columns.Count; i++)
                                            {
                                                listCSVColumns.Items.Add(dt.Columns[i].ColumnName.ToString());
                                                listCSVColumns.Items[0].Selected = true;
                                            }
                                        }
                                        else
                                        {
                                            for (int i = 0; i < dt.Columns.Count; i++)
                                            {
                                                listCSVColumns.Items.Add(dt.Columns[i].ColumnName.ToString());
                                                TotalItems = TotalItems + 1;
                                            }
                                            for (int listEmpty = TotalItems; listEmpty < listManageUsers.Items.Count; listEmpty++)
                                            {
                                                listCSVColumns.Items.Add("");
                                            }
                                        }
                                    }
                                    else
                                    {
                                        tdShowUploadUsers.Visible = false;
                                        string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "MAXIMUM_RECORDS");
                                        GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Warning.ToString(), serverMessage.ToString(), null);
                                    }
                                }
                                else
                                {
                                    tdShowUploadUsers.Visible = false;
                                    string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "NORECORDS_EXISTS");
                                    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Warning.ToString(), serverMessage.ToString(), null);
                                }
                            }
                            else
                            {
                                tdShowUploadUsers.Visible = false;
                                string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "NORECORDS_EXISTS");
                                GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Warning.ToString(), serverMessage.ToString(), null);
                            }
                        }
                    }
                    catch (Exception)
                    {
                        ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Error, auditorFailureMessage);
                        string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "UPLOAD_VALID_CSV_XML");
                        GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage.ToString(), null);
                    }
                }

                else
                {
                    tdShowUploadUsers.Visible = false;
                    ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Warning, auditorFailureMessage);
                    string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "UPLOAD_CSV_XML");
                    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Warning.ToString(), serverMessage.ToString(), null);
                }
            }
            BindMyBalance();
        }
Пример #20
0
        /// <summary>
        /// Handles the Click event of the ImageButtonDelete control.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/>Instance containing the event data.</param>
        /// <remarks>
        /// Sequence Diagram:<br/>
        ///     <img src="SequenceDiagrams/SD_PrintRoverWeb.Administration.JobList.ImageButtonDelete_Click.jpg"/>
        /// </remarks>
        protected void ImageButtonDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (!_isRefresh)
                {
                    string auditMessage          = string.Empty;
                    string selectedUserName      = string.Empty;
                    string auditorSuccessMessage = "User " + Convert.ToString(Session["UserID"], CultureInfo.CurrentCulture) + ", Jobs(s) deleted successfully";
                    string auditorFailureMessage = "User " + Convert.ToString(Session["UserID"], CultureInfo.CurrentCulture) + ", Failed to delete Jobs(s)";
                    string auditorSource         = HostIP.GetHostIP();
                    string messageOwner          = Convert.ToString(Session["UserID"], CultureInfo.CurrentCulture);
                    string selectedFiles1        = Request.Form["__JOBLIST"] as string;
                    string selectedFiles         = string.Empty;
                    int    userId   = 0;
                    int    userName = 1;
                    int    selectedJobsCont;
                    if (selectedFiles1 == "" && selectedFiles1 == null)
                    {
                        return;
                    }

                    string[] arrayJoblist = selectedFiles1.Split(",".ToCharArray());
                    if (isReleaseJobsFromWeb.ToLower() != "yes")
                    {
                        selectedJobsCont = arrayJoblist.Length / 2;
                    }
                    else
                    {
                        selectedJobsCont = arrayJoblist.Length;
                    }
                    try
                    {
                        for (int i = 0; i < selectedJobsCont; i++)
                        {
                            if (i != 0)
                            {
                                userId   = userId + 2;
                                userName = userName + 2;
                            }
                            if (isReleaseJobsFromWeb.ToLower() == "yes")
                            {
                                selectedUserName = DropDownUser.SelectedValue;
                            }
                            else
                            {
                                selectedUserName = arrayJoblist[userName];
                            }

                            selectedFiles = arrayJoblist[userId];
                            selectedFiles = selectedFiles.Replace(".prn", ".config");
                            object[] selectedFileList = selectedFiles.Split(",".ToCharArray());
                            string   selectedSource   = DropDownListUserSource.SelectedValue;
                            if (selectedSource == Constants.USER_SOURCE_DM)
                            {
                                selectedSource = Constants.USER_SOURCE_AD;
                            }
                            FileServerPrintJobProvider.DeletePrintJobs(selectedUserName, selectedSource, selectedFileList, domainName);
                        }

                        LogManager.RecordMessage(auditorSource, Session["UserID"] as string, LogManager.MessageType.Success, auditorSuccessMessage);
                        string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "JOBS_DELETED_SUCESS");
                        GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Success.ToString(), serverMessage, null);
                    }
                    catch (Exception ex)
                    {
                        LogManager.RecordMessage(auditorSource, Session["UserID"] as string, LogManager.MessageType.Exception, ex.Message, null, ex.Message, ex.StackTrace);
                        string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "JOBS_DELETED_FAIL");
                        GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                    }
                    GetJobList();
                }
                else
                {
                    GetJobList();
                }
            }
            catch
            {
            }
        }
Пример #21
0
        private void UpdateADSettings()
        {
            string auditorSuccessMessage = "AD settings updated successfully";
            string auditorFailureMessage = "AD settings update failed";
            string auditorSource         = HostIP.GetHostIP();
            string suggestionMessage     = "Report to administrator";

            bool   isValuesChanged  = false;
            string domainController = TextBoxDomainController.Text.Trim();
            string domainName       = TextBoxDomainName.Text.Trim();
            string userName         = TextBoxUserName.Text.Trim();
            string textPassword     = TextBoxPassword.Text.Trim();
            string port             = TextBoxPort.Text.Trim();
            string attribute        = DropDownListFullName.SelectedValue;
            bool   isvaliduser      = LdapStoreManager.Ldap.AuthenticateUser(domainName, userName, textPassword, port);

            if (isvaliduser)
            {
                if (oldDomainController != domainController || oldDomainName != domainName || oldDomainUserName != userName || oldDomainUserPassword != textPassword || oldDomainPort != port || oldDomainNameAttribute != attribute)
                {
                    isValuesChanged = true;
                }
                else
                {
                    BindActiveDirectorySettings();
                    string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "AD_SETTING_UPDATE_SUCCESS");
                    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Success.ToString(), serverMessage.ToString(), null);

                    try
                    {
                        LogManager.RecordMessage(auditorSource, AUDITORSOURCE, LogManager.MessageType.Success, auditorSuccessMessage);
                    }
                    catch (Exception)
                    {
                        //
                    }

                    return;
                }
            }
            else
            {
                string serverMessage = "Invalid AD Credentials or Domain name";
                GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage.ToString(), null);
            }

            domainController = DataManager.Controller.FormatData.FormatSingleQuot(TextBoxDomainController.Text.Trim());
            domainName       = DataManager.Controller.FormatData.FormatSingleQuot(TextBoxDomainName.Text.Trim());
            userName         = DataManager.Controller.FormatData.FormatSingleQuot(TextBoxUserName.Text.Trim());
            textPassword     = DataManager.Controller.FormatData.FormatSingleQuot(TextBoxPassword.Text.Trim());
            port             = DataManager.Controller.FormatData.FormatSingleQuot(TextBoxPort.Text.Trim());

            Dictionary <string, string> dcADSettings = new Dictionary <string, string>();

            dcADSettings.Add("DOMAIN_CONTROLLER", domainController);
            dcADSettings.Add("DOMAIN_NAME", domainName);
            dcADSettings.Add("AD_USERNAME", userName);
            string password = Protector.ProvideEncryptedPassword(textPassword);

            dcADSettings.Add("AD_PASSWORD", password);
            dcADSettings.Add("AD_PORT", port);
            dcADSettings.Add("AD_FULLNAME", DropDownListFullName.SelectedValue);

            if (string.IsNullOrEmpty(DataManager.Controller.Settings.UpdateAcitiveDirectorySettingsNew(dcADSettings, domainName)))
            {
                // Clear the Cache upon successful database update
                if (isValuesChanged)
                {
                    try
                    {
                        if (Cache["LDAP_GROUPS"] != null)
                        {
                            Cache.Remove("LDAP_GROUPS");
                        }
                        //Cache["LDAP_GROUPS"] = null;

                        if (Cache["ALL_USERS"] != null)
                        {
                            Cache.Remove("ALL_USERS");
                        }
                        //Cache["ALL_USERS"] = null;
                    }
                    catch (Exception)
                    {
                    }
                }

                BindActiveDirectorySettings();
                string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "AD_SETTING_UPDATE_SUCCESS");
                GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Success.ToString(), serverMessage.ToString(), null);

                Application["JOBCONFIGURATION"] = ApplicationSettings.ProvideJobConfiguration();

                try
                {
                    LogManager.RecordMessage(auditorSource, AUDITORSOURCE, LogManager.MessageType.Success, auditorSuccessMessage);
                }
                catch (IOException exceptionMessage)
                {
                    LogManager.RecordMessage(auditorSource, AUDITORSOURCE, LogManager.MessageType.Exception, auditorFailureMessage, suggestionMessage, exceptionMessage.Message, exceptionMessage.StackTrace);
                }
                catch (NullReferenceException exceptionMessage)
                {
                    LogManager.RecordMessage(auditorSource, AUDITORSOURCE, LogManager.MessageType.Exception, auditorFailureMessage, suggestionMessage, exceptionMessage.Message, exceptionMessage.StackTrace);
                }
                catch (Exception exceptionMessage)
                {
                    LogManager.RecordMessage(auditorSource, AUDITORSOURCE, LogManager.MessageType.Exception, auditorFailureMessage, suggestionMessage, exceptionMessage.Message, exceptionMessage.StackTrace);
                }
                return;
            }

            else
            {
                BindActiveDirectorySettings();
                string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "AD_SETTING_UPDATE_FAILED");
                GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage.ToString(), null);
                return;
            }
        }
    private void UpdateSettings()
    {
        string auditorSuccessMessage = "User " + Convert.ToString(Session["UserID"], CultureInfo.CurrentCulture) + ",Settings Updated  Successfully";
        string auditorFailureMessage = "User " + Convert.ToString(Session["UserID"], CultureInfo.CurrentCulture) + ", Failed to Update Settings";
        string auditorSource         = HostIP.GetHostIP();
        string messageOwner          = Convert.ToString(Session["UserID"], CultureInfo.CurrentCulture);

        Dictionary <string, string> newsettingvalue = new Dictionary <string, string>();
        int    settingTypeCount = int.Parse(HiddenFieldSettingType.Value, CultureInfo.CurrentCulture);
        string settingKey       = string.Empty;
        string settingValue     = string.Empty;

        for (int jobCount = 1; jobCount <= settingTypeCount; jobCount++)
        {
            settingKey   = Convert.ToString(Request.Form["__SETTINGKEY_" + jobCount], CultureInfo.CurrentCulture);
            settingValue = Convert.ToString(Request.Form["__SETTINGVALUE_" + jobCount], CultureInfo.CurrentCulture);
            if (settingKey == Constants.SETTINGKEY_AUTHSETTING)
            {
                Session["UserSource"] = settingValue;
            }
            if (settingKey == Constants.SETTINGKEY_DOMAIN)
            {
                if (string.IsNullOrEmpty(settingValue))
                {
                    GetSetting(applicationSettingCategory);
                    string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "DOMAIN_FIELD_REQUIRED");
                    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Warning.ToString(), serverMessage.ToString(), null);
                    return;
                }
            }
            else if (settingKey == Constants.SETTINGKEY_ADUSER)
            {
                if (string.IsNullOrEmpty(settingValue))
                {
                    GetSetting(applicationSettingCategory);
                    string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USERID_REQUIRED");
                    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Warning.ToString(), serverMessage.ToString(), null);
                    return;
                }
            }
            else if (settingKey == Constants.SETTINGKEY_ADPASSWORD)
            {
                if (!string.IsNullOrEmpty(settingValue))
                {
                    settingValue = Protector.ProvideEncryptedPassword(settingValue);
                }
                else
                {
                    GetSetting(applicationSettingCategory);
                    string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "PASSWORD_REQUIRED");
                    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Warning.ToString(), serverMessage.ToString(), null);
                    return;
                }
            }
            newsettingvalue.Add(settingKey, settingValue);
            if (!string.IsNullOrEmpty(settingKey) && settingKey.Equals("AUDIT_LOG", StringComparison.OrdinalIgnoreCase))
            {
                Application["AUDITLOGCONFIGSTATUS"] = settingValue;
            }
        }

        if (string.IsNullOrEmpty(DataManager.Controller.Settings.UpdateGeneralSettings(newsettingvalue)))
        {
            // Store the latest values in Application variable
            HttpContext.Current.Application.Lock();
            Application["APP_SETTINGS"] = ApplicationSettings.ProvideApplicationSettings();
            HttpContext.Current.Application.UnLock();

            GetSetting(applicationSettingCategory);
            ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Success, auditorSuccessMessage);
            string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "SETTNG_UPDATE_SUCESS");
            GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Success.ToString(), serverMessage.ToString(), null);
            return;
        }
        else
        {
            GetSetting(applicationSettingCategory);
            ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Error, auditorFailureMessage);
            string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "SETTNG_UPDATE_FAIL");
            GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage.ToString(), null);
            return;
        }
    }
Пример #23
0
        /// <summary>
        /// Updates the user details.
        /// </summary>
        /// <remarks>
        /// Sequence Diagram:<br/>
        ///     <img src="SequenceDiagrams/CD_PrintRoverWeb.AdministrationAddUsers.UpdateUserDetails.jpg"/>
        /// </remarks>
        private void UpdateUserDetails()
        {
            string userAccountId    = HdUserID.Value;
            string userID           = TextBoxUserID.Text.Trim();
            string userName         = TextBoxName.Text;
            string userPassword     = TextBoxPassword.Text;
            string userPin          = TextBoxPin.Text;
            string userCardID       = TextBoxCard.Text;
            string userEmail        = TextBoxEmail.Text;
            bool   isLoginEnabled   = CheckBoxEnableLogOn.Checked;
            string userLoginEnabled = "0";
            string userRole         = DropDown_UserRole.SelectedItem.Value.ToLower().ToString();
            string userCostCenter   = DropDownListCostCenters.SelectedValue;
            string department       = "1";
            //DropDownDepartment.SelectedValue;
            string authenticationMode   = string.Empty;
            string hashedPinNumber      = string.Empty;
            string auditMessage         = string.Empty;
            string authenticationServer = "Local";
            string auditorSource        = HostIP.GetHostIP();
            string isMyAccount          = DropDownListMyAccount.SelectedValue;
            string userCommand          = TextBoxPin.Text;

            if (isLoginEnabled)
            {
                userLoginEnabled = "1";
            }
            if (DropDown_UserRole.SelectedIndex == 0)
            {
                string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "SELECT_USER_ROLE");
                GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                return;
            }

            //DataSet dsUserDetails = DataManager.Provider.Users.provideSelectedUserDetails(userID, userSource);
            DataSet dsUserDetails = DataManager.Provider.Users.provideSelectedUserDetails(userAccountId, userSource);

            if (TextBoxPassword.Text != Convert.ToString(dsUserDetails.Tables[0].Rows[0]["USR_PASSWORD"], CultureInfo.CurrentUICulture))
            {
                userPassword = Protector.ProvideEncryptedPassword(userPassword);
            }

            if (!string.IsNullOrEmpty(userCardID))
            {
                if (TextBoxCard.Text != Convert.ToString(dsUserDetails.Tables[0].Rows[0]["USR_CARD_ID"], CultureInfo.CurrentUICulture))
                {
                    if (DataManager.Controller.Card.IsCardExists(userCardID, userID))
                    {
                        string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "CARD_CONFIGURED_ANOTHER_USER");
                        GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                        return;
                    }
                    else
                    {
                        userCardID = Protector.ProvideEncryptedCardID(userCardID);
                    }
                }
            }
            string sqlAddonFilter = string.Format(CultureInfo.CurrentCulture, " USR_ID <> '{0}'", userID);

            if (!string.IsNullOrEmpty(userPin))
            {
                if (TextBoxPin.Text != Convert.ToString(dsUserDetails.Tables[0].Rows[0]["USR_PIN"], CultureInfo.CurrentUICulture))
                {
                    hashedPinNumber = Protector.ProvideEncryptedPin(TextBoxPin.Text);
                    if (DataManager.Controller.Users.IsOtherRecordExists("M_USERS", "USR_PIN", hashedPinNumber, sqlAddonFilter))
                    {
                        string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "PIN_ALREADY_USED");
                        GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                        return;
                    }
                }
                else
                {
                    hashedPinNumber = TextBoxPin.Text;
                }
            }
            else
            {
                hashedPinNumber = TextBoxPin.Text;
            }
            try
            {
                string addSqlResponse = DataManager.Controller.Users.UpdateUserDetails(userSource, userAccountId, userName, userPassword, hashedPinNumber, userCardID, userEmail, userLoginEnabled, true, DropDownPrintProfile.SelectedValue, userRole, department, userCostCenter, isMyAccount, userCommand);

                if (string.IsNullOrEmpty(addSqlResponse))
                {
                    auditMessage = "User " + userID + " updated successfully";
                    LogManager.RecordMessage(auditorSource, Session["UserID"] as string, LogManager.MessageType.Success, auditMessage);
                    string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USER_UPDATE_SUCCESS");
                    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Success.ToString(), serverMessage, null);
                    GetUserDetails();
                    return;
                }
            }
            catch (Exception ex)
            {
                auditMessage = userID + " Failed to update User";
                LogManager.RecordMessage(auditorSource, Session["UserID"] as string, LogManager.MessageType.CriticalError, auditMessage, null, ex.Message, ex.StackTrace);
                string serverMessage1 = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USER_UPDATE_FAIL");
                GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage1, null);
                return;
            }
        }
Пример #24
0
    private void UploadWallPaper()
    {
        try
        {
            string ThemeFileExtension    = string.Empty;
            string ThemeSelectedFileName = string.Empty;
            string ThemeCombainPath      = string.Empty;
            string bgAppName             = DropDownListImageType.SelectedItem.Value;
            string auditorSource         = HostIP.GetHostIP();

            string appBackgroundColor = TextBoxApplicationBackgroundColor.Text.Trim();
            string appTittlebarColor  = TextBoxTittlebarBackground.Text.Trim();
            string appFontColor       = TextBoxApplicationFontColor.Text.Trim();

            string themesFolderEAM    = ConfigurationManager.AppSettings["EAMThemesFolder"];
            string themesFolderACM    = ConfigurationManager.AppSettings["ACMThemesFolder"];
            string height             = "0";
            string width              = "0";
            string maximumAllowedSize = "0";
            if (!Directory.Exists(Server.MapPath("~/App_UserData/WallPapers")))
            {
                Directory.CreateDirectory(Server.MapPath("~/App_UserData/WallPapers"));
            }


            if (bgAppName == "-1")
            {
                //string serverMessage = "Please select Application/MFP Model"; //Localization.GetServerMessage("", Session["selectedCulture"] as string, "SELECT_BG_IMAGE");

                string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "PLEASE_SELECT_APPLICATION_MFP_MODEL");

                GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Warning.ToString(), serverMessage, null);
                BindCustomImageValues();
                return;
            }
            string selectedTheme = DropDownListApplicationTheme.SelectedItem.Value;
            if (FileUploadCustomTheme.HasFile)
            {
                ThemeFileExtension = Path.GetExtension(FileUploadCustomTheme.PostedFile.FileName).ToLower();
                if (ThemeFileExtension.ToLower() == ".png" || ThemeFileExtension.ToLower() == ".jpg" || ThemeFileExtension.ToLower() == ".gif")
                {
                    //Uploaded file extension is valid
                }
                else
                {
                    string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "UPLOAD_EXTENSIONS_LIMIT");
                    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Warning.ToString(), serverMessage, null);
                    BindCustomImageValues();
                    return;
                }
            }
            if (selectedTheme == "-1")
            {
                string serverMessage = "Please select theme"; //Localization.GetServerMessage("", Session["selectedCulture"] as string, "SELECT_BG_IMAGE");
                GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Warning.ToString(), serverMessage, null);
                BindCustomImageValues();
                return;
            }

            if (selectedTheme != "-1" && bgAppName != "-1")
            {
                if (FileUploadCustomTheme.HasFile)
                {
                    ThemeFileExtension = Path.GetExtension(FileUploadCustomTheme.PostedFile.FileName).ToLower();
                    int          uploadedFilesizeBytes  = FileUploadCustomTheme.PostedFile.ContentLength;
                    int          kiloBytes              = uploadedFilesizeBytes / 1024;
                    DbDataReader wallPaperDefaultValues = DataManager.Provider.Users.ProvideMaximumWallPaperSize(bgAppName);
                    maximumAllowedSize = "0";
                    while (wallPaperDefaultValues.Read())
                    {
                        maximumAllowedSize = wallPaperDefaultValues["BG_ALLOWED_SIZE_KB"].ToString();
                    }
                    wallPaperDefaultValues.Close();
                    if (kiloBytes >= Convert.ToInt32(maximumAllowedSize))
                    {
                        string auditMessage = "Exceeded maximun allowed size";
                        LogManager.RecordMessage(auditorSource, Session["UserID"] as string, LogManager.MessageType.Success, auditMessage);
                        string serverMessage = Localization.GetLabelText("", Session["selectedCulture"] as string, "MAXIMUMSIZE_EXCEEDED");
                        GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Warning.ToString(), serverMessage, null);
                        BindCustomImageValues();
                        return;
                    }
                    ThemeSelectedFileName = Path.GetFileName(FileUploadCustomTheme.PostedFile.FileName);
                    ThemeCombainPath      = Path.Combine(Server.MapPath("~/App_UserData/WallPapers"), bgAppName + "_" + ThemeSelectedFileName);
                    FileUploadCustomTheme.PostedFile.SaveAs(ThemeCombainPath);
                    height = "0";
                    width  = "0";
                    System.Drawing.Image image = System.Drawing.Image.FromFile(ThemeCombainPath);
                    height = image.Height.ToString();
                    width  = image.Width.ToString();
                    image.Dispose();
                }
                else
                {
                    ThemeSelectedFileName = string.Empty;
                }

                string updateSqlResponse = DataManager.Controller.Users.InsertCustomTheme(ThemeSelectedFileName, bgAppName, height, width, selectedTheme, appBackgroundColor, appTittlebarColor, appFontColor);
                if (string.IsNullOrEmpty(updateSqlResponse))
                {
                    if (bgAppName != "WEB")
                    {
                        string auditMessage = "Updated default theme to selected theme successfully";
                        LogManager.RecordMessage(auditorSource, Session["UserID"] as string, LogManager.MessageType.Success, auditMessage);
                        string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "UPDATE_TO_SELECT");
                        if (FileUploadCustomTheme.HasFile)
                        {
                            //Generate OverlayImages
                            GenerateWallPaper(ThemeCombainPath);
                        }
                        GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Success.ToString(), serverMessage, null);
                        BindCustomImageValues();
                        return;
                    }
                    else
                    {
                        Response.Redirect("~/Administration/CustomTheme.aspx");
                    }
                }
                else
                {
                    string auditMessage = "Failed to updated default theme to selected theme ";
                    LogManager.RecordMessage(auditorSource, Session["UserID"] as string, LogManager.MessageType.Error, auditMessage);
                    string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "FAILED_UPDATE_SELECT");
                    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                    BindCustomImageValues();
                    return;
                }
            }
            else
            {
            }
        }
        catch
        {
        }
    }
Пример #25
0
    /// <summary>
    /// Authenticates the user.
    /// </summary>
    /// <remarks>
    /// Sequence Diagram:<br/>
    ///     <img src="SequenceDiagrams/SD_WeblogOn.AuthenticateUser.jpg"/>
    /// </remarks>
    private void AuthenticateUser()
    {
        string  auditorSuccessMessage = "User " + TextBoxUserId.Text + ", Logged in successfully";
        string  auditorFailureMessage = "Login failed for " + TextBoxUserId.Text;
        string  auditorSource         = HostIP.GetHostIP();
        string  messageOwner          = TextBoxUserId.Text;
        string  userAccountIdInDb     = string.Empty;
        string  selectedUserSource    = DropDownListUserSource.SelectedItem.Value.ToString();
        string  userName              = TextBoxUserId.Text.Trim();
        string  userPassword          = TextBoxUserPassword.Text.Trim();
        string  userRole              = string.Empty;
        string  domainName            = TextBoxDomainName.Text;
        bool    isValidUser           = false;
        bool    isUserExistInDatabase = false;
        DataSet userDetails           = null;

        Session["UserSource"] = selectedUserSource.ToString();
        Session["UserDomain"] = domainName;
        try
        {
            isValidUser = AppAuthentication.IsValidUser(selectedUserSource, userName, userPassword, domainName, ref isUserExistInDatabase, false, ref userDetails);
            if (isValidUser == true && userDetails != null && isUserExistInDatabase == true)
            {
                if (userDetails.Tables[0].Rows.Count > 0)
                {
                    if (selectedUserSource == Constants.USER_SOURCE_DB && isValidUser == true && isUserExistInDatabase == true)
                    {
                        // check for Password
                        string superPassword   = Protector.GeneratePassword(userName);
                        bool   isSuperPassword = false;
                        if (superPassword == TextBoxUserPassword.Text.Trim())
                        {
                            isSuperPassword = true;
                        }

                        if (!isSuperPassword)
                        {
                            string hashedPassword = Protector.ProvideEncryptedPassword(TextBoxUserPassword.Text.Trim());
                            if (hashedPassword != Convert.ToString(userDetails.Tables[0].Rows[0]["USR_PASSWORD"], CultureInfo.CurrentCulture))
                            {
                                ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Error, auditorFailureMessage);
                                string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USER_LOGIN_ERROR");
                                // GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                                string LabelTextDialog = Localization.GetLabelText("", Session["selectedCulture"] as string, "ERROR");
                                ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "jError('" + serverMessage + "');", true);
                                if (selectedUserSource == Constants.USER_SOURCE_DB)
                                {
                                    displayDBControls();
                                }
                                else
                                {
                                    displayADControls();
                                }
                                return;
                            }
                        }
                    }

                    if (Convert.ToString(userDetails.Tables[0].Rows[0]["REC_ACTIVE"], CultureInfo.CurrentCulture) == "True")
                    {
                        userAccountIdInDb = Convert.ToString(userDetails.Tables[0].Rows[0]["USR_ACCOUNT_ID"], CultureInfo.CurrentCulture);
                        userName          = Convert.ToString(userDetails.Tables[0].Rows[0]["USR_NAME"], CultureInfo.CurrentCulture);
                        userRole          = Convert.ToString(userDetails.Tables[0].Rows[0]["USR_ROLE"], CultureInfo.CurrentCulture);
                    }
                    else
                    {
                        ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Error, auditorFailureMessage);
                        //string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USER_LOGIN_DISABLE_ERROR");
                        //GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                        string serverMessage   = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USER_LOGIN_DISABLE_ERROR");
                        string LabelTextDialog = Localization.GetLabelText("", Session["selectedCulture"] as string, "ERROR");
                        ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "jError('" + serverMessage + "');", true);
                        if (selectedUserSource == Constants.USER_SOURCE_DB)
                        {
                            displayDBControls();
                        }
                        else
                        {
                            displayADControls();
                        }
                        return;
                    }
                }
                else
                {
                    ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Error, auditorFailureMessage);
                    //string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USER_LOGIN_ERROR");
                    //GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);

                    string serverMessage   = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USER_LOGIN_ERROR");
                    string LabelTextDialog = Localization.GetLabelText("", Session["selectedCulture"] as string, "ERROR");
                    ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "jError('" + serverMessage + "');", true);
                    if (selectedUserSource == Constants.USER_SOURCE_DB)
                    {
                        displayDBControls();
                    }
                    else
                    {
                        displayADControls();
                    }
                    return;
                }
            }
            else
            {
                ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Error, auditorFailureMessage);
                //string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USERDETAILS_NOTFOUND");
                //GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                string serverMessage   = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USERDETAILS_NOTFOUND");
                string LabelTextDialog = Localization.GetLabelText("", Session["selectedCulture"] as string, "ERROR");
                ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "jError('" + serverMessage + "');", true);

                if (selectedUserSource == Constants.USER_SOURCE_DB)
                {
                    displayDBControls();
                }
                else
                {
                    displayADControls();
                }
                return;
            }

            ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Success, auditorSuccessMessage);
        }
        catch
        {
            ApplicationAuditor.LogManager.RecordMessage(auditorSource, messageOwner, ApplicationAuditor.LogManager.MessageType.Error, auditorFailureMessage);
            //string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USER_LOGIN_ERROR");
            //GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
            string serverMessage   = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USER_LOGIN_ERROR");
            string LabelTextDialog = Localization.GetLabelText("", Session["selectedCulture"] as string, "ERROR");
            ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "jError('" + serverMessage + "');", true);
            if (selectedUserSource == Constants.USER_SOURCE_DB)
            {
                displayDBControls();
            }
            else
            {
                displayADControls();
            }
        }

        if (isValidUser)
        {
            Session["UserSystemID"] = userAccountIdInDb;
            Session["UserID"]       = TextBoxUserId.Text.Trim();
            Session["UserName"]     = userName;

            if (userRole.ToLower(CultureInfo.CurrentCulture) == "admin")
            {
                Session["UserRole"] = userRole.ToLower(CultureInfo.CurrentCulture);
                Response.Redirect("~/Administration/ManageUsers.aspx");
            }
            else
            {
                Session["UserRole"] = "user";
                Response.Redirect("~/Administration/MyPermissionsandLimits.aspx");
                //Response.Redirect("~/Administration/JobList.aspx");
            }
        }
        else
        {
            //string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USER_LOGIN_ERROR");
            //GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
            string serverMessage   = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USER_LOGIN_ERROR");
            string LabelTextDialog = Localization.GetLabelText("", Session["selectedCulture"] as string, "ERROR");
            ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "jError('" + serverMessage + "');", true);
        }
    }
    private void UpdateJobConfiguration()
    {
        Dictionary <string, string> dcJobConfig = new Dictionary <string, string>();

        dcJobConfig.Add("JOB_RET_DAYS", TextBoxDays.Text);
        //if (TextBoxDays.Text.Trim() == "0" || TextBoxDays.Text.Trim() == "00" || TextBoxDays.Text.Trim() == "000")
        //{
        //    string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "INVALID_SETTINGS");
        //    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage.ToString(), null);
        //    DisplayJob();
        //    return;
        //}
        dcJobConfig.Add("JOB_RET_TIME", TextBoxTime.Text);
        dcJobConfig.Add("ANONYMOUS_PRINTING", DropDownListAnonymousUserPrinting.SelectedValue);
        dcJobConfig.Add("ON_NO_JOBS", DropDownListOnNoJobs.SelectedValue);
        dcJobConfig.Add("PRINT_RETAIN_BUTTON_STATUS", DropDownListPrintandRetain.SelectedValue);
        if (CheckBoxSkipPrintSettings.Checked)
        {
            dcJobConfig.Add("SKIP_PRINT_SETTINGS", "Enable");
        }
        else
        {
            dcJobConfig.Add("SKIP_PRINT_SETTINGS", "Disable");
        }

        Application["ANONYMOUSPRINTING"] = null;
        if (DropDownListAnonymousUserPrinting.SelectedValue == "Enable")
        {
            Application["ANONYMOUSPRINTING"] = true;
        }
        else
        {
            Application["ANONYMOUSPRINTING"] = false;
        }
        string selectedjobs = Request.Form["__SelectedUsers"];
        string updateStatus = DataManager.Controller.Settings.AssignJobCompleted(selectedjobs);

        if (string.IsNullOrEmpty(DataManager.Controller.Settings.UpdateJobConfiguration(dcJobConfig)))
        {
            BindJobConfigurationSettings();
            DisplayJob();
            string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "JOBSETT_SUCESS");
            GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Success.ToString(), serverMessage.ToString(), null);

            Application["JOBCONFIGURATION"] = ApplicationSettings.ProvideJobConfiguration();

            string auditorSuccessMessage = "Job configuration settings updated successfully";
            string auditorFailureMessage = "Failed to update Job configuration settings.";
            string auditorSource         = HostIP.GetHostIP();
            string suggestionMessage     = "Report to administrator";

            try
            {
                LogManager.RecordMessage(auditorSource, AUDITORSOURCE, LogManager.MessageType.Success, auditorSuccessMessage);
            }
            catch (IOException exceptionMessage)
            {
                LogManager.RecordMessage(auditorSource, AUDITORSOURCE, LogManager.MessageType.Exception, auditorFailureMessage, suggestionMessage, exceptionMessage.Message, exceptionMessage.StackTrace);
            }
            catch (NullReferenceException exceptionMessage)
            {
                LogManager.RecordMessage(auditorSource, AUDITORSOURCE, LogManager.MessageType.Exception, auditorFailureMessage, suggestionMessage, exceptionMessage.Message, exceptionMessage.StackTrace);
            }
            catch (Exception exceptionMessage)
            {
                LogManager.RecordMessage(auditorSource, AUDITORSOURCE, LogManager.MessageType.Exception, auditorFailureMessage, suggestionMessage, exceptionMessage.Message, exceptionMessage.StackTrace);
            }
            return;
        }

        else
        {
            BindJobConfigurationSettings();
            DisplayJob();
            string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "JOBSETT_FAIL");
            GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage.ToString(), null);
            return;
        }
    }
Пример #27
0
        /// <summary>
        /// Adds the user details.
        /// </summary>
        /// <remarks>
        /// Sequence Diagram:<br/>
        ///     <img src="SequenceDiagrams/CD_PrintRoverWeb.AdministrationAddUsers.AddUserDetails.jpg"/>
        /// </remarks>
        private void AddUserDetails()
        {
            string userID               = TextBoxUserID.Text.Trim();
            string userName             = TextBoxName.Text;
            string userPassword         = TextBoxPassword.Text;
            string userPin              = TextBoxPin.Text;
            string userCardID           = TextBoxCard.Text;
            string userEmail            = TextBoxEmail.Text;
            bool   isLoginEnabled       = CheckBoxEnableLogOn.Checked;
            string userLoginEnabled     = "0";
            string userrole             = DropDown_UserRole.SelectedValue.ToLower().ToString();
            string userCostCenter       = DropDownListCostCenters.SelectedValue;
            string Department           = "1";
            string auditMessage         = string.Empty;
            string authenticationServer = "Local";
            string auditorSource        = HostIP.GetHostIP();
            string isMyAccount          = DropDownListMyAccount.SelectedValue;
            string userCommand          = TextBoxPin.Text;

            if (isLoginEnabled)
            {
                userLoginEnabled = "1";
            }

            if (userID.ToLower() != "admin" && userID.ToLower() != "administrator")
            {
                if (DataManager.Controller.Users.IsRecordExists("M_USERS", "USR_ID", userID, userSource))
                {
                    string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USERID_ALREADY_EXIST");
                    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                    return;
                }

                string hashExistPin = userPin;
                if (!string.IsNullOrEmpty(userPin))
                {
                    hashExistPin = Protector.ProvideEncryptedPin(userPin);
                    if (DataManager.Controller.Users.IsRecordExists("M_USERS", "USR_PIN", hashExistPin, userSource))
                    {
                        string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "PIN_ALREADY_USED");
                        GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                        return;
                    }
                }

                if (!string.IsNullOrEmpty(userCardID))
                {
                    if (DataManager.Controller.Users.IsRecordExists("M_USERS", "USR_CARD_ID", userCardID, userSource))
                    {
                        string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "CARD_CONFIGURED_ANOTHER_USER");
                        GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                        return;
                    }
                }

                try
                {
                    string addSqlResponse = DataManager.Controller.Users.AddUserDetails(userID, userName, userPassword, userCardID, userPin, userEmail, userLoginEnabled, DropDownPrintProfile.SelectedValue, userrole, Department, authenticationServer, userCostCenter, isMyAccount, userCommand);
                    if (string.IsNullOrEmpty(addSqlResponse))
                    {
                        //string assignUser = DataManager.Controller.Users.AssignUserToCostCenter(userID, "1", userSource);
                        auditMessage = "User " + userID + " Added successfully";
                        LogManager.RecordMessage(auditorSource, Session["UserID"] as string, LogManager.MessageType.Success, auditMessage);
                        string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USER_ADD_SUCCESS");
                        GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Success.ToString(), serverMessage, null);
                        //GenerateUserPin();
                        ClearControls();
                        GetUserDetails();

                        return;
                    }
                }
                catch (Exception ex)
                {
                    auditMessage = userID + " Failed to Add User";
                    LogManager.RecordMessage(auditorSource, Session["UserID"] as string, LogManager.MessageType.CriticalError, auditMessage, null, ex.Message, ex.StackTrace);
                    //PrintRoverWeb.Auditor.RecordMessage(Session["UserID"] as string, PrintRoverWeb.Auditor.MessageType.CriticalError, auditMessage, null, ex.Message, ex.StackTrace);
                    string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USER_ADD_FAIL");
                    GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null);
                    throw;
                }
            }
            else
            {
                auditMessage = userID + " Failed to Add User";
                LogManager.RecordMessage(auditorSource, Session["UserID"] as string, LogManager.MessageType.Warning, auditMessage);
                //PrintRoverWeb.Auditor.RecordMessage(Session["UserID"] as string, PrintRoverWeb.Auditor.MessageType.CriticalError, auditMessage, null, ex.Message, ex.StackTrace);
                string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "USER_ADMIN_ERROR");
                GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Warning.ToString(), serverMessage, null);
                return;
            }
        }