public JsonResult AddAircraft(AircraftData aircraftData)
 {
     try
     {
         var result = DashboardBusiness.PostAircraftData(aircraftData);
         if (result != null)
         {
             return(new JsonResult {
                 Data = result
             });
         }
         else
         {
             return(new JsonResult {
                 Data = "Error!!"
             });
         }
     }
     catch (Exception ex)
     {
         return(new JsonResult {
             Data = ex.Message
         });
     }
 }
Esempio n. 2
0
    private void Fill_cmbDashboard_DashboradSettings_UserSettings(ComboBox comboboxDashboard, HiddenField ErrorHiddenFieldDashboard)
    {
        string[] retMessage = new string[4];

        this.InitializeCulture();
        try
        {
            IList <GTS.Clock.Model.BaseInformation.Dashboards> dashboardList = DashboardBusiness.GetAll();
            comboboxDashboard.DataSource = dashboardList;
            comboboxDashboard.DataBind();
            comboboxDashboard.Items.Insert(0, new ComboBoxItem()
            {
                Value = "0", Text = GetLocalResourceObject("cmbDashboard_DashboradSettings_UserSettings_ItemNone").ToString()
            });
        }
        catch (UIValidationExceptions ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
            ErrorHiddenFieldDashboard.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
        catch (UIBaseException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
            ErrorHiddenFieldDashboard.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
        catch (Exception ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
            ErrorHiddenFieldDashboard.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
    }
 public JsonResult GetAircraftData()
 {
     try
     {
         var result = DashboardBusiness.GetAircraftData();
         if (result != null)
         {
             return(new JsonResult {
                 Data = result, JsonRequestBehavior = JsonRequestBehavior.AllowGet
             });
         }
         else
         {
             return(new JsonResult {
                 Data = "Error!!"
             });
         }
     }
     catch (Exception ex)
     {
         return(new JsonResult {
             Data = ex.Message
         });
     }
 }
Esempio n. 4
0
 public DashboardFacade(string connectionString) : base(connectionString)
 {
     try
     {
         rep = new DashboardBusiness(StringCipher.Decrypt(Connection, General.passPhrase));
     }
     catch
     {
         rep = new DashboardBusiness(Connection);
     }
 }
Esempio n. 5
0
 public JsonResult InitialData(int month, int year)
 {
     var incomeBusiness = new DashboardBusiness(db);
     var initialData = incomeBusiness.GetInitialData(month, year);
     var model = new { initialData.expenses, initialData.revenues, initialData.monthBalance };
     var result = new JsonResult
     {
         Data = JsonConvert.SerializeObject(model),
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     };
     return result;
 }
Esempio n. 6
0
    public string[] UpdateSettings_UserSettingsPage(string caller, string settingsState, string personnelLoadState, string personnelCountState, string PersonnelID, string PersonnelSearchTerms, string SettingsTerms)
    {
        this.InitializeCulture();

        string[]            retMessage    = new string[4];
        Caller              settingCaller = (Caller)Enum.Parse(typeof(Caller), this.StringBuilder.CreateString(caller));
        SettingsState       SS            = (SettingsState)Enum.Parse(typeof(SettingsState), this.StringBuilder.CreateString(settingsState));
        LoadState           PLS           = (LoadState)Enum.Parse(typeof(LoadState), this.StringBuilder.CreateString(personnelLoadState));
        PersonnelCountState PCS           = (PersonnelCountState)Enum.Parse(typeof(PersonnelCountState), this.StringBuilder.CreateString(personnelCountState));
        decimal             personnelID   = decimal.Parse(this.StringBuilder.CreateString(PersonnelID), CultureInfo.InvariantCulture);

        PersonnelSearchTerms = this.StringBuilder.CreateString(PersonnelSearchTerms);
        SettingsTerms        = this.StringBuilder.CreateString(SettingsTerms);


        try
        {
            AttackDefender.CSRFDefender(this.Page);
            switch (SS)
            {
            case SettingsState.EmailSMS:
                EmailSMSSettingsObj emailSMSSettingsObj = this.JsSerializer.Deserialize <EmailSMSSettingsObj>(SettingsTerms);
                bool IsSendEmail = bool.Parse(emailSMSSettingsObj.IsSendEmail);
                bool IsSendSMS   = bool.Parse(emailSMSSettingsObj.IsSendSMS);
                EmailSMSTransferState SendEmailState = (EmailSMSTransferState)Enum.Parse(typeof(EmailSMSTransferState), emailSMSSettingsObj.SendEmailState);
                EmailSMSTransferState SendSMSState   = (EmailSMSTransferState)Enum.Parse(typeof(EmailSMSTransferState), emailSMSSettingsObj.SendSMSState);
                int    EmailDay        = int.Parse(emailSMSSettingsObj.DailyEmailDay, CultureInfo.InvariantCulture);
                string DailyEmailTime  = emailSMSSettingsObj.DailyEmailHour + ":" + emailSMSSettingsObj.DailyEmailMinute;
                string HourlyEmailTime = emailSMSSettingsObj.HourlyEmailHour + ":" + emailSMSSettingsObj.HourlyEmailMinute;
                int    SMSDay          = int.Parse(emailSMSSettingsObj.DailySMSDay, CultureInfo.InvariantCulture);
                string DailySMSTime    = emailSMSSettingsObj.DailySMSHour + ":" + emailSMSSettingsObj.DailySMSMinute;
                string HourlySMSTime   = emailSMSSettingsObj.HourlySMSHour + ":" + emailSMSSettingsObj.HourlySMSMinute;

                EmailSettings emailSettings = new EmailSettings();
                emailSettings.Active = IsSendEmail;
                switch (SendEmailState)
                {
                case EmailSMSTransferState.Daily:
                    emailSettings.SendByDay = true;
                    break;

                case EmailSMSTransferState.Hourly:
                    emailSettings.SendByDay = false;
                    break;
                }
                emailSettings.DayCount   = EmailDay;
                emailSettings.TheDayHour = DailyEmailTime;
                emailSettings.TheHour    = HourlyEmailTime;

                SMSSettings smsSettings = new SMSSettings();
                smsSettings.Active = IsSendSMS;
                switch (SendSMSState)
                {
                case EmailSMSTransferState.Daily:
                    smsSettings.SendByDay = true;
                    break;

                case EmailSMSTransferState.Hourly:
                    smsSettings.SendByDay = false;
                    break;
                }
                smsSettings.DayCount   = SMSDay;
                smsSettings.TheDayHour = DailySMSTime;
                smsSettings.TheHour    = HourlySMSTime;


                switch (PCS)
                {
                case PersonnelCountState.Single:
                    switch (settingCaller)
                    {
                    case Caller.Personal:
                        this.UserSettingsBusiness.SaveEmailSetting(emailSettings);
                        this.UserSettingsBusiness.SaveSMSSetting(smsSettings);
                        break;

                    case Caller.Management:
                        this.UserSettingsBusiness.SaveEmailSetting(emailSettings, personnelID);
                        this.UserSettingsBusiness.SaveSMSSetting(smsSettings, personnelID);
                        break;

                    default:
                        break;
                    }
                    break;

                case PersonnelCountState.Group:
                    switch (PLS)
                    {
                    case LoadState.Normal:
                        this.UserSettingsBusiness.SaveEmailSetting(emailSettings, personnelID);
                        this.UserSettingsBusiness.SaveSMSSetting(smsSettings, personnelID);
                        break;

                    case LoadState.Search:
                        this.UserSettingsBusiness.SaveEmailSetting(emailSettings, PersonnelSearchTerms);
                        this.UserSettingsBusiness.SaveSMSSetting(smsSettings, PersonnelSearchTerms);
                        break;

                    case LoadState.AdvancedSearch:
                        this.UserSettingsBusiness.SaveEmailSetting(emailSettings, this.APSProv.CreateAdvancedPersonnelSearchProxy(PersonnelSearchTerms));
                        this.UserSettingsBusiness.SaveSMSSetting(smsSettings, this.APSProv.CreateAdvancedPersonnelSearchProxy(PersonnelSearchTerms));
                        break;
                    }
                    break;
                }
                break;

            case SettingsState.Dashboard:
                DashboardSettingsObj dashboardSettingsObj = this.JsSerializer.Deserialize <DashboardSettingsObj>(SettingsTerms);
                IList <Dashboards>   dashboardList        = DashboardBusiness.GetAll();

                decimal dashboardID1 = dashboardSettingsObj.DashboardID1 == "" ? 0 : Convert.ToDecimal(dashboardSettingsObj.DashboardID1, CultureInfo.InvariantCulture);
                decimal dashboardID2 = dashboardSettingsObj.DashboardID2 == "" ? 0 : Convert.ToDecimal(dashboardSettingsObj.DashboardID2, CultureInfo.InvariantCulture);
                decimal dashboardID3 = dashboardSettingsObj.DashboardID3 == "" ? 0 : Convert.ToDecimal(dashboardSettingsObj.DashboardID3, CultureInfo.InvariantCulture);
                decimal dashboardID4 = dashboardSettingsObj.DashboardID4 == "" ? 0 : Convert.ToDecimal(dashboardSettingsObj.DashboardID4, CultureInfo.InvariantCulture);

                DashboardSettings dashboardObj = new DashboardSettings();
                dashboardObj.Dashboard1 = dashboardList.SingleOrDefault(d => d.ID == dashboardID1);
                dashboardObj.Dashboard2 = dashboardList.SingleOrDefault(d => d.ID == dashboardID2);
                dashboardObj.Dashboard3 = dashboardList.SingleOrDefault(d => d.ID == dashboardID3);
                dashboardObj.Dashboard4 = dashboardList.SingleOrDefault(d => d.ID == dashboardID4);

                switch (PCS)
                {
                case PersonnelCountState.Single:
                    switch (settingCaller)
                    {
                    case Caller.Personal:
                        this.UserSettingsBusiness.SaveDashboardSetting(dashboardObj);

                        break;

                    case Caller.Management:
                        this.UserSettingsBusiness.SaveDashboardSetting(dashboardObj, personnelID);

                        break;

                    default:
                        break;
                    }
                    break;

                case PersonnelCountState.Group:
                    switch (PLS)
                    {
                    case LoadState.Normal:
                        this.UserSettingsBusiness.SaveDashboardSetting(dashboardObj, personnelID);

                        break;

                    case LoadState.Search:
                        this.UserSettingsBusiness.SaveDashboardSetting(dashboardObj, PersonnelSearchTerms);

                        break;

                    case LoadState.AdvancedSearch:
                        this.UserSettingsBusiness.SaveDashboardSetting(dashboardObj, this.APSProv.CreateAdvancedPersonnelSearchProxy(PersonnelSearchTerms));

                        break;
                    }
                    break;
                }
                break;

            case SettingsState.CollectiveRequestRegistType:
                OperatorCollectiveRequestRegistType operatorCollectiveRequestTypeObj = this.JsSerializer.Deserialize <OperatorCollectiveRequestRegistType>(SettingsTerms);
                CollectiveRequestRegistType         collectiveRequestRegistTypeObj   = (CollectiveRequestRegistType)Enum.Parse(typeof(CollectiveRequestRegistType), operatorCollectiveRequestTypeObj.CollectiveRequestRegistType);

                switch (PCS)
                {
                case PersonnelCountState.Single:
                    switch (settingCaller)
                    {
                    case Caller.Personal:
                        this.UserSettingsBusiness.SaveOperatorCollectiveRequestRegistType(collectiveRequestRegistTypeObj);

                        break;

                    case Caller.Management:
                        this.UserSettingsBusiness.SaveOperatorCollectiveRequestRegistType(collectiveRequestRegistTypeObj, personnelID);

                        break;

                    default:
                        break;
                    }
                    break;

                case PersonnelCountState.Group:
                    switch (PLS)
                    {
                    case LoadState.Normal:
                        this.UserSettingsBusiness.SaveOperatorCollectiveRequestRegistType(collectiveRequestRegistTypeObj, personnelID);

                        break;

                    case LoadState.Search:
                        this.UserSettingsBusiness.SaveOperatorCollectiveRequestRegistType(collectiveRequestRegistTypeObj, PersonnelSearchTerms);

                        break;

                    case LoadState.AdvancedSearch:
                        this.UserSettingsBusiness.SaveOperatorCollectiveRequestRegistType(collectiveRequestRegistTypeObj, this.APSProv.CreateAdvancedPersonnelSearchProxy(PersonnelSearchTerms));

                        break;
                    }
                    break;
                }
                break;
            }
            retMessage[0] = GetLocalResourceObject("RetSuccessType").ToString();
            retMessage[1] = GetLocalResourceObject("OperationCompleted").ToString();
            retMessage[2] = "success";
            retMessage[3] = SS.ToString();
            return(retMessage);
        }
        catch (UIValidationExceptions ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
            return(retMessage);
        }
        catch (UIBaseException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
            return(retMessage);
        }
        catch (Exception ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
            return(retMessage);
        }
    }
Esempio n. 7
0
 public DashboardController()
 {
     _dashboardBusiness = new DashboardBusiness(_applicationServicesSetup, _user);
 }