Example #1
0
        protected void dgItemSubCategory_UpdateCommand(object source, DataGridCommandEventArgs e)
        {
            int             id = (int)dgItemSubCategory.DataKeys[e.Item.ItemIndex];
            ItemSubCategory itemSubCategory = _presenter.GetItemSubCategoryById(id);

            try
            {
                DropDownList ddlEdtItemCategory = e.Item.FindControl("ddlEdtItemCategory") as DropDownList;
                itemSubCategory.ItemCategory = _presenter.GetItemCategoryById(Convert.ToInt32(ddlEdtItemCategory.SelectedValue));
                TextBox txtEdtName = e.Item.FindControl("txtEdtName") as TextBox;
                itemSubCategory.Name = txtEdtName.Text;
                TextBox txtEdtCode = e.Item.FindControl("txtEdtCode") as TextBox;
                itemSubCategory.Code = txtEdtCode.Text;
                SaveItemSubCategory(itemSubCategory);
                dgItemSubCategory.EditItemIndex = -1;
                BindItemSubCategory();
            }
            catch (Exception ex)
            {
                Master.ShowMessage(new AppMessage("Error: Unable to Update Item Sub Category. " + ex.Message, RMessageType.Error));
                ExceptionUtility.LogException(ex, ex.Source);
                ExceptionUtility.NotifySystemOps(ex, _presenter.CurrentUser().FullName);
            }
        }
 private void RellenaAmistades()
 {
     if (User.Identity.IsAuthenticated)
     {
         MembershipUser usr = Membership.GetUser();
         if (usr != null)
         {
             try
             {
                 using (Clases.cASPNET_FRIENDSHIP objAmigos = new Clases.cASPNET_FRIENDSHIP())
                 {
                     objAmigos.aceptado    = true;
                     objAmigos.fromuserid  = Convert.ToInt32(usr.ProviderUserKey);
                     lstFriends.DataSource = objAmigos.CommonUsers(10, 1, -1, string.Empty, string.Empty);
                     lstFriends.DataBind();
                 }
             }
             catch (Exception excp)
             {
                 ExceptionUtility.LogException(excp, "Error en la función << RellenaAmistades() >>");
             }
         }
     }
 }
Example #3
0
 public static void KeepAlive()
 {
     while (true)
     {
         try
         {
             WebRequest request = WebRequest.Create("http://argentinasismos.com/Home/WakeUp");
             using (WebResponse resp = request.GetResponse())
             {
             }
             Thread.Sleep(60000);
         }
         catch (ThreadAbortException tae)
         {
             ExceptionUtility.Error(tae.Message);
             break;
         }
         catch (Exception ex)
         {
             ExceptionUtility.Error(ex.Message);
             break;
         }
     }
 }
    public bool DeleteProduct(int productId)
    {
        bool isDeleted = false;

        try
        {
            DBConnection.conn.Open();
            string     query = "DELETE FROM dbo.tblInventory WHERE ProductId=@prodId";
            SqlCommand cmd1  = new SqlCommand(query, DBConnection.conn);
            cmd1.Parameters.AddWithValue("@prodId", productId);
            int result = cmd1.ExecuteNonQuery();
            if (result > 0)
            {
                query = "DELETE FROM dbo.tblProduct WHERE ProductId=@prodId  ";
                SqlCommand cmd = new SqlCommand(query, DBConnection.conn);
                cmd.Parameters.AddWithValue("@prodId", productId);
                result = cmd.ExecuteNonQuery();
                if (result > 0)
                {
                    isDeleted = true;
                }
            }
        }
        catch (Exception e)
        {
            ExceptionUtility.LogException(e, "Error Page");
        }
        finally
        {
            if (DBConnection.conn != null)
            {
                DBConnection.conn.Close();
            }
        }
        return(isDeleted);
    }
Example #5
0
        async void MakeTestResultViewModel(ITestResultMessage testResult, TestState outcome)
        {
            var tcs = new TaskCompletionSource <TestResultViewModel>(TaskCreationOptions.RunContinuationsAsynchronously);

            if (!_testCases.TryGetValue(testResult.TestCase, out TestCaseViewModel? testCase))
            {
                // no matching reference, search by Unique ID as a fallback
                testCase = _testCases.FirstOrDefault(kvp => kvp.Key.UniqueID?.Equals(testResult.TestCase.UniqueID) ?? false).Value;

                if (testCase == null)
                {
                    return;
                }
            }

            // Create the result VM on the UI thread as it updates properties
            _context.Post(_ =>
            {
                var result = new TestResultViewModel(testCase, testResult)
                {
                    Duration = TimeSpan.FromSeconds((double)testResult.ExecutionTime)
                };

                if (outcome == TestState.Failed)
                {
                    result.ErrorMessage    = ExceptionUtility.CombineMessages((ITestFailed)testResult);
                    result.ErrorStackTrace = ExceptionUtility.CombineStackTraces((ITestFailed)testResult);
                }

                tcs.TrySetResult(result);
            }, null);

            var r = await tcs.Task;

            _listener.RecordResult(r);             // bring it back to the threadpool thread
        }
            public SelectionHeader() : base(fullWidth: true)
            {
                ExceptionUtility.Try(() =>
                {
                    //cancel button
                    this._cancelButton.SetTitle(StringLiterals.CancelButtonText, UIControlState.Normal);
                    this._cancelButton.SetFontAndColor(NavHeaderFont);
                    this._cancelButton.TouchUpInside += (o, e) =>
                    {
                        LogUtility.LogMessage("User clicked cancel button (circuits).");
                        if (this.OnCancel != null)
                        {
                            this.OnCancel();
                        }
                    };

                    //selected label
                    this._selectedLabel.SetFontAndColor(NavHeaderBoldFont);

                    //select all button
                    this._selectAllButton.SetTitle(StringLiterals.SelectAllButtonText, UIControlState.Normal);
                    this._selectAllButton.SetFontAndColor(NavHeaderFont);
                    this._selectAllButton.TouchUpInside += (o, e) =>
                    {
                        LogUtility.LogMessage("User clicked select all button (circuits).");
                        if (this.OnSelectAll != null)
                        {
                            this.OnSelectAll();
                        }
                    };

                    this.BackgroundColor = Colors.AquamonixBrown;

                    this.AddSubviews(_selectedLabel, _cancelButton, _selectAllButton);
                });
            }
Example #7
0
        /// <summary>
        /// Caches the response locally in the service layer.
        /// </summary>
        /// <param name="request">The request that prompted the response</param>
        /// <param name="response">The response to cache</param>
        protected void CacheResponse(IApiRequest request, IApiResponse response)
        {
            if (Environment.AppSettings.CachingEnabled)
            {
                ExceptionUtility.Try(() =>
                {
                    if (response != null && response.IsSuccessful)
                    {
                        string key  = this.GenerateCacheKey(request);
                        var newItem = new CacheItem()
                        {
                            CacheSeconds = CacheTimeoutSeconds,
                            Response     = response,
                            TimeStamp    = DateTime.Now
                        };

                        this._internalCache.AddOrUpdate(key, newItem, (k, v) =>
                        {
                            return(newItem);
                        });
                    }
                });
            }
        }
Example #8
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (_packageRestoreManager != null)
            {
                NuGetUIThreadHelper.JoinableTaskFactory.RunAsync(async delegate
                {
                    try
                    {
                        string solutionDirectory = await _solutionManager.GetSolutionDirectoryAsync(CancellationToken.None);

                        // when the control is first loaded, check for missing packages
                        await _packageRestoreManager.RaisePackagesMissingEventForSolutionAsync(solutionDirectory, CancellationToken.None);
                    }
                    catch (Exception ex)
                    {
                        await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
                        // By default, restore bar is invisible. So, in case of failure of RaisePackagesMissingEventForSolutionAsync, assume it is needed
                        UpdateRestoreBar(packagesMissing: true);
                        var unwrappedException = ExceptionUtility.Unwrap(ex);
                        ShowErrorUI(unwrappedException.Message);
                    }
                }).PostOnFailure(nameof(PackageRestoreBar));
            }
        }
Example #9
0
 private void RellenaUltimosAmigos()
 {
     if (this.iduser.HasValue)
     {
         try
         {
             using (Clases.cASPNET_FRIENDSHIP objAmigos = new Clases.cASPNET_FRIENDSHIP())
             {
                 objAmigos.fromuserid         = this.iduser;
                 objAmigos.aceptado           = true;
                 lstLastSixFriends.DataSource = objAmigos.ObtenerDatos(6, 1, " FECHA DESC ");
                 lstLastSixFriends.DataBind();
             }
         }
         catch (Exception excp)
         {
             ExceptionUtility.LogException(excp, "Error en la función << RellenaUltimosAmigos() >>");
         }
     }
     else
     {
         Response.Redirect("~/errors/notfound.aspx");
     }
 }
Example #10
0
        protected void dgStore_UpdateCommand(object source, DataGridCommandEventArgs e)
        {
            int   id    = (int)dgStore.DataKeys[e.Item.ItemIndex];
            Store Store = _presenter.GetStoreById(id);

            try
            {
                TextBox txtEdtName = e.Item.FindControl("txtEdtName") as TextBox;
                Store.Name = txtEdtName.Text;
                TextBox txtEdtLocation = e.Item.FindControl("txtEdtLocation") as TextBox;
                Store.Location = txtEdtLocation.Text;
                DropDownList ddlStatus = e.Item.FindControl("ddlStatus") as DropDownList;
                Store.Status = ddlStatus.SelectedValue;
                SaveStore(Store);
                dgStore.EditItemIndex = -1;
                BindStore();
            }
            catch (Exception ex)
            {
                Master.ShowMessage(new AppMessage("Error: Unable to Update Location. " + ex.Message, RMessageType.Error));
                ExceptionUtility.LogException(ex, ex.Source);
                ExceptionUtility.NotifySystemOps(ex, _presenter.CurrentUser().FullName);
            }
        }
        public void Decode(byte[] data)
        {
            if (data == null)
            {
                throw ExceptionUtility.ArgumentNull("data");
            }

            try
            {
                var s     = Asn1Sequence.FromByteArray(data) as Asn1Sequence;
                var s0    = s[0] as Asn1Sequence;
                var s1    = (s[1] as Asn1TaggedObject).GetObject() as Asn1Sequence;
                var s11   = (s1[1] as Asn1TaggedObject).GetObject() as Asn1Sequence;
                var s1101 = (s11[0] as Asn1Sequence)[1] as Asn1Sequence;

                SessionEncryptedKey = new GostKeyExchangeInfo
                {
                    EncryptionParamSet = (s1[0] as DerObjectIdentifier).Id,
                    EncryptedKey       = (s0[0] as DerOctetString).GetOctets(),
                    Mac = (s0[1] as DerOctetString).GetOctets(),
                    Ukm = (s1[2] as DerOctetString).GetOctets()
                };
                TransportParameters = new GostKeyExchangeParameters
                {
                    PublicKeyParamSet  = (s1101[0] as DerObjectIdentifier).Id,
                    DigestParamSet     = (s1101[1] as DerObjectIdentifier).Id,
                    EncryptionParamSet = s1101.Count > 2 ? (s1101[2] as DerObjectIdentifier).Id : null,
                    PublicKey          = (DerOctetString.FromByteArray((s11[1] as DerBitString).GetBytes()) as DerOctetString).GetOctets(),
                    PrivateKey         = null
                };
            }
            catch (Exception exception)
            {
                throw ExceptionUtility.CryptographicException(exception, Resources.Asn1DecodeError, "GostR3410KeyTransportDecode");
            }
        }
        /// <summary>
        /// Расшифровать идентификатор OID параметров шифрования.
        /// </summary>
        public static string DecodeEncryptionParamSet(byte[] data)
        {
            if (data == null)
            {
                throw ExceptionUtility.ArgumentNull(nameof(data));
            }

            string encryptionParamSet;

            try
            {
                var asnDecoder = new Asn1BerDecodeBuffer(data);
                var parameters = new Gost_28147_89_BlobParams();
                parameters.Decode(asnDecoder);

                encryptionParamSet = parameters.EncryptionParamSet.Oid.Value;
            }
            catch (Exception exception)
            {
                throw ExceptionUtility.CryptographicException(exception, Resources.Asn1DecodeError, typeof(Gost_28147_89_BlobParams).FullName);
            }

            return(encryptionParamSet);
        }
 private void RellenaCategorias()
 {
     try
     {
         using (Clases.cKPI_CATEGORIES objCategorias = new Clases.cKPI_CATEGORIES())
         {
             cmbCategorias.DataTextField  = "NOMBRE";
             cmbCategorias.DataValueField = "CATEGORYID";
             cmbCategorias.DataSource     = objCategorias.ObtenerDatos(" AND A.CATEGORYID > 1");
             cmbCategorias.DataBind();
         }
     }
     catch (Exception excp)
     {
         ExceptionUtility.LogException(excp, "Error en la función << RellenaCategorias() >>");
     }
     finally
     {
         if (cmbCategorias.Items.Count > 0)
         {
             RellenaSubcategorias();
         }
     }
 }
        public void CanConvertSingleAfterTestException()
        {
            var afterExceptions = new Exception[1];

            afterExceptions[0] = GenerateSingleException();
            var exception = new AfterTestException(afterExceptions);

            var message    = ExceptionUtility.GetMessage(exception);
            var stackTrace = ExceptionUtility.GetStackTrace(exception);

            string simplifiedMessage;
            var    taskExceptions = ExceptionConverter.ConvertExceptions(exception.GetType().FullName, message,
                                                                         stackTrace, out simplifiedMessage);

            Assert.NotNull(taskExceptions);
            Assert.Equal(1, taskExceptions.Length);

            Assert.Equal(afterExceptions[0].GetType().FullName, taskExceptions[0].Type);
            Assert.Equal(afterExceptions[0].Message, taskExceptions[0].Message);
            Assert.Equal(afterExceptions[0].StackTrace, taskExceptions[0].StackTrace);

            // TODO: RS6 uses full exception name. Does previous versions?
            Assert.Equal("Xunit.Sdk.AfterTestException: One or more exceptions were thrown from After methods during test cleanup", simplifiedMessage);
        }
Example #15
0
            public NavBarView() : base(fullWidth: true)
            {
                ExceptionUtility.Try(() =>
                {
                    //cancel button
                    this._cancelButton.SetTitle(StringLiterals.CancelButtonText, UIControlState.Normal);
                    this._cancelButton.SetFontAndColor(new FontWithColor(Fonts.RegularFontName, Sizes.FontSize8, UIColor.White));
                    this._cancelButton.TouchUpInside += (o, e) =>
                    {
                        if (this.OnCancel != null)
                        {
                            this.OnCancel();
                        }
                    };

                    //selected label
                    this._titleLabel.SetFontAndColor(new FontWithColor(Fonts.SemiboldFontName, Sizes.FontSize8, UIColor.White));
                    this._titleLabel.Text = StringLiterals.StartCircuits;

                    this.BackgroundColor = Colors.AquamonixGreen;

                    this.AddSubviews(_titleLabel, _cancelButton);
                });
            }
Example #16
0
        public string GetUserGroups()
        {
            DirectorySearcher search = new DirectorySearcher(entry);

            search.Filter = "(cn=" + _filterAttribute + ")";
            search.PropertiesToLoad.Add("memberOf");
            StringBuilder groupNames = new StringBuilder();

            try
            {
                SearchResult result        = search.FindOne();
                Int32        propertyCount = result.Properties["memberOf"].Count;
                string       dn;
                Int32        equalsIndex;
                Int32        commaIndex;

                for (int propertyCounter = 0; propertyCounter < propertyCount; propertyCounter++)
                {
                    dn          = (string)result.Properties["memberOf"][propertyCounter];
                    equalsIndex = dn.IndexOf("=", 1);
                    commaIndex  = dn.IndexOf(",", 1);
                    if (equalsIndex == -1)
                    {
                        return(null);
                    }
                    groupNames.Append(dn.Substring((equalsIndex + 1), (commaIndex - equalsIndex) - 1));
                    groupNames.Append("|");
                }
            }
            catch (Exception ex)
            {
                ExceptionUtility.LogException(ex);
                throw new Exception("Error obtaining group names. " + ex.Message);
            }
            return(groupNames.ToString());
        }
        public override byte[] EncodePrivateKey(Gost_28147_89_SymmetricAlgorithmBase keyExchangeAlgorithm, GostKeyExchangeExportMethod keyExchangeExportMethod)
        {
            if (keyExchangeAlgorithm == null)
            {
                throw ExceptionUtility.ArgumentNull(nameof(keyExchangeAlgorithm));
            }

            int keyExchangeExportAlgId;

            if (keyExchangeExportMethod == GostKeyExchangeExportMethod.GostKeyExport)
            {
                keyExchangeExportAlgId = Constants.CALG_SIMPLE_EXPORT;
            }
            else if (keyExchangeExportMethod == GostKeyExchangeExportMethod.CryptoProKeyExport)
            {
                keyExchangeExportAlgId = Constants.CALG_PRO_EXPORT;
            }
            else
            {
                throw ExceptionUtility.ArgumentOutOfRange(nameof(keyExchangeExportMethod));
            }

            var currentSessionKey = keyExchangeAlgorithm as Gost_28147_89_SymmetricAlgorithm;

            if (currentSessionKey == null)
            {
                using (var derivedSessionKey = new Gost_28147_89_SymmetricAlgorithm(ProviderType))
                {
                    derivedSessionKey.Key = keyExchangeAlgorithm.Key;

                    return(EncodePrivateKeyInternal(derivedSessionKey, keyExchangeExportAlgId));
                }
            }

            return(EncodePrivateKeyInternal(currentSessionKey, keyExchangeExportAlgId));
        }
Example #18
0
 public static void EmailResetPassword(string username, string emailId, string resetKey)
 {
     try
     {
         ConfigurationUtility.GetConfigurationUsingSection();
         MailMessage   message = new MailMessage(ApplicationConstants.AISEmail, emailId);
         StringBuilder body    = new StringBuilder();
         body.Append(" <p> Did you forget your password? No problem! Please click the link below to reset your password. </p><br/> ");
         body.Append("<p><a href=\"" + ApplicationVariables.ResetPasswordLink + username + resetKey + "\">Please click here to reset your password</a>" + " </p>")
         .Append("<p>If you cannot access this link, copy and paste the entire URL into your browser.</p><br/><br/><br/>")
         .Append("Regards,<br/>")
         .Append("Auckland Institute of Studies");
         message.Body       = body.ToString();
         message.Subject    = "AIS - ILMPMS| Reset Password";
         message.IsBodyHtml = true;
         SmtpClient smtpclient = new SmtpClient();
         smtpclient.Send(message);
     }
     catch (Exception ex)
     {
         ExceptionUtility.LogException(ex, "Error logger");
         throw new CustomException(ApplicationConstants.UnhandledException + ": " + ex.Message);
     }
 }
Example #19
0
        public static T ParseResponse <T>(string json) where T : IApiResponse
        {
            var output = default(T);

            ExceptionUtility.Try(() =>
            {
                output = JsonUtility.Deserialize <T>(json);

                if (output != null)
                {
                    output.RawResponse = json;
                }

                if (output?.Header != null && output?.Header.Type == ResponseType.SystemError)
                {
                    ErrorResponse errorResponse = JsonUtility.Deserialize <ErrorResponse>(json);
                    output.ErrorBody            = errorResponse.Body;
                }

                output?.ReadyResponse();
            });

            return(output);
        }
Example #20
0
        public static void objBroadCastProcessor_OnBroadCastRecievedNew(ScripDetails objScripDetails)
        {
            try
            {
                int scripCode = objScripDetails.ScriptCode;
                //ScripDetails objScripDetails = BroadcastMasterMemory.objScripDetailsConDict.Where(x => x.Key == scripCode).Select(x => x.Value).FirstOrDefault();
                if (objScripDetails != null && ObjTouchlineDataCollection.Count > 0)
                {
                    List <int> list = new List <int>();
                    list = ObjTouchlineDataCollection.Where(i => i.Scriptcode1 == scripCode).Select(x => ObjTouchlineDataCollection.IndexOf(x)).ToList();

                    for (int i = 0; i < list.Count; i++)
                    {
                        UpdateGrid(list[i], objScripDetails);
                    }
                }
                // BestFiveVM.objBroadCastProcessor_OnBroadCastRecieved(scripCode);
            }
            catch (Exception ex)
            {
                ExceptionUtility.LogError(ex);
                return;
            }
        }
Example #21
0
    public bool updateProfile(User user)
    {
        bool status = false;

        try
        {
            DBConnection.conn.Open();
            string query = "UPDATE dbo.tblUser SET FirstName=@FirstName,LastName=@LastName,Email=@Email,PhoneNumber=@PhoneNumber,"
                           + "Password=@Password,Address=@Address WHERE UserId=@UserId ";
            SqlCommand cmd = new SqlCommand(query, DBConnection.conn);
            cmd.Parameters.AddWithValue("@FirstName", user.FirstName);
            cmd.Parameters.AddWithValue("@LastName", user.LastName);
            cmd.Parameters.AddWithValue("@Email", user.Email);
            cmd.Parameters.AddWithValue("@PhoneNumber", user.Phone);
            cmd.Parameters.AddWithValue("@Password", user.Password);
            cmd.Parameters.AddWithValue("@Address", user.Address);
            cmd.Parameters.AddWithValue("@UserId", user.UserId);
            int result = cmd.ExecuteNonQuery();
            if (result > 0)
            {
                status = true;
            }
        }
        catch (SqlException e)
        {
            ExceptionUtility.LogException(e, "Error Page");
        }
        finally
        {
            if (DBConnection.conn != null)
            {
                DBConnection.conn.Close();
            }
        }
        return(status);
    }
Example #22
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (_packageRestoreManager != null)
            {
                NuGetUIThreadHelper.JoinableTaskFactory.RunAsync(async delegate
                {
                    try
                    {
                        string solutionDirectory = await _solutionManager.GetSolutionDirectoryAsync(CancellationToken.None);
                        _componentModel          = await AsyncServiceProvider.GlobalProvider.GetComponentModelAsync();
                        _vsSolutionManager       = _componentModel.GetService <IVsSolutionManager>();

                        // when the control is first loaded, check for missing packages
                        if (await ExperimentUtility.IsTransitiveOriginExpEnabled.GetValueAsync(CancellationToken.None) &&
                            _projectContextInfo?.ProjectStyle == ProjectModel.ProjectStyle.PackageReference &&
                            await GetMissingAssetsFileStatusAsync(_projectContextInfo.ProjectId))
                        {
                            _solutionRestoreWorker = _componentModel.GetService <ISolutionRestoreWorker>();
                            _packageRestoreManager.RaiseAssetsFileMissingEventForProjectAsync(true);
                        }
                        else
                        {
                            await _packageRestoreManager.RaisePackagesMissingEventForSolutionAsync(solutionDirectory, CancellationToken.None);
                        }
                    }
                    catch (Exception ex)
                    {
                        await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
                        // By default, restore bar is invisible. So, in case of failure of RaisePackagesMissingEventForSolutionAsync, assume it is needed
                        UpdateRestoreBar(packagesMissing: true);
                        var unwrappedException = ExceptionUtility.Unwrap(ex);
                        ShowErrorUI(unwrappedException.Message);
                    }
                }).PostOnFailure(nameof(PackageRestoreBar));
            }
        }
Example #23
0
        public void LogHandlingError()
        {
            if (!EventLog.SourceExists(EventLogSource))
            {
                return;
            }

            Exception ex = new Exception(exceptionMessage);

            ExceptionUtility.FormatExceptionHandlingExceptionMessage(policy, null, null, ex);

            StringBuilder message = new StringBuilder();
            StringWriter  writer  = null;

            try
            {
                writer = new StringWriter(message);
                TextExceptionFormatter formatter = new TextExceptionFormatter(writer, ex);
                formatter.Format();
            }
            finally
            {
                if (writer != null)
                {
                    writer.Close();
                }
            }

            using (EventLog log = new EventLog(EventLogName))
            {
                EventLogEntry entry = log.Entries[log.Entries.Count - 1];

                Assert.AreEqual(EventLogEntryType.Error, entry.EntryType);
                Assert.AreEqual(EventLogSource, entry.Source);
            }
        }
Example #24
0
 public List <Booking> GetBookingsByHotelID(string hotelID)
 {
     try
     {
         SqlDataReader  bookingRD = HRSBookingDALObject.GetBookingsByHotelID(hotelID);
         List <Booking> bookings  = new List <Booking>();
         while (bookingRD.Read())
         {
             Booking booking = new Booking();
             booking.BookingID     = bookingRD["BookingID"].ToString();
             booking.ArrivalDate   = DateTime.Parse(bookingRD["ArrivalDate"].ToString());
             booking.DepartureDate = DateTime.Parse(bookingRD["DepartureDate"].ToString());
             booking.RoomType      = bookingRD["RoomType"].ToString();
             booking.TotalRooms    = Convert.ToInt32(bookingRD["TotalRooms"].ToString());
             bookings.Add(booking);
         }
         return(bookings);
     }
     catch (Exception ex)
     {
         ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }
Example #25
0
        /// <summary>
        /// Called When Modify Button is clicked. Pending order can be modified
        /// </summary>
        private void Modify_ClickButton()
        {
            try
            {
                //if (SelectedValue != null)
                if (SelectedValue != null && SelectedValue.Count > 0)
                {
#if BOW
                    //OrderProcessor.GetOrderDataFromOrderID(SelectedValue.FirstOrDefault());
                    OrderProcessor.GetOrderDataFromOrderID(SelectedValue.FirstOrDefault());
#elif TWS
                    OrderProcessor.GetOrderDataByMessageTag(SelectedValue.FirstOrDefault());
#endif
                }
                else
                {
                    MessageBox.Show("Please Select the Order to Modify", "Modify Order", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            catch (Exception ex)
            {
                ExceptionUtility.LogError(ex);
            }
        }
Example #26
0
        /// <summary>
        /// Substracts a request from each IP address in the collection.
        /// </summary>
        private static void TimerElapsed(object sender, ElapsedEventArgs e)
        {
            try
            {
                var listOfIpsToModify = new List <string>();

                foreach (string key in _IpAdresses.Keys)
                {
                    listOfIpsToModify.Add(key);
                }
                foreach (var key in listOfIpsToModify)
                {
                    _IpAdresses[key]--;
                    if (_IpAdresses[key] == 0)
                    {
                        _IpAdresses.Remove(key);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionUtility.Error(string.Concat(ex.Message, "DosAttackModule"));
            }
        }
Example #27
0
        private void MainForm_Load
        (
            object sender,
            EventArgs e
        )
        {
            CheckFileExist("irbis64.dll");
            CheckFileExist("irbis65.dll");
            CheckFileExist("borlndmm.dll");

            string serverIniPath
                = ConfigurationUtility.GetString
                  (
                      "server-ini"
                  );

            if (string.IsNullOrEmpty(serverIniPath))
            {
                ExceptionUtility.Throw
                (
                    "server-ini parameter is empty"
                );
            }
        }
Example #28
0
    protected void txtStudentId_TextChanged(object sender, EventArgs e)
    {
        StudentBO studentBO = new StudentBO();
        int       studentId = 0;

        if (txtStudentId.Text.Trim() != "")
        {
            try
            {
                studentId = int.Parse(txtStudentId.Text.Trim());
                string studentName = studentBO.GetStudentNameForId(studentId);
                txtName.Text = studentName;
                if (studentName == "")
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('  Please enter a valid student id ');", true);
                    // Response.Write("<script>alert(' Please enter a valid student id ');</script>");
                }
            }
            catch (ParseException)
            {
                ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('  Please enter a valid student id ');", true);
                //Response.Write("<script>alert(' Please enter a valid student id ');</script>");
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert(' Error in getting student details ');", true);
                //Response.Write("<script>alert(' Error in getting student details ');</script>");
                ExceptionUtility.LogException(ex, "Error Page");
            }
        }
        else
        {
            txtStudentId.Text = "";
            txtName.Text      = "";
        }
    }
Example #29
0
        public void ToXml_WithClassFailure()
        {
            Exception ex;

            try
            {
                throw new InvalidOperationException("message");
            }
            catch (Exception e)
            {
                ex = e;
            }

            XmlDocument doc = new XmlDocument();

            doc.LoadXml("<foo/>");
            XmlNode     parentNode  = doc.ChildNodes[0];
            ClassResult classResult = new ClassResult(typeof(object));

            classResult.SetException(ex);

            XmlNode resultNode = classResult.ToXml(parentNode);

            Assert.Equal("class", resultNode.Name);
            Assert.Equal(classResult.FullyQualifiedName, resultNode.Attributes["name"].Value);
            Assert.Equal("0.000", resultNode.Attributes["time"].Value);
            Assert.Equal("1", resultNode.Attributes["total"].Value);
            Assert.Equal("0", resultNode.Attributes["passed"].Value);
            Assert.Equal("1", resultNode.Attributes["failed"].Value);
            Assert.Equal("0", resultNode.Attributes["skipped"].Value);
            XmlNode failureNode = resultNode.SelectSingleNode("failure");

            Assert.Equal(ex.GetType().FullName, failureNode.Attributes["exception-type"].Value);
            Assert.Equal(ExceptionUtility.GetMessage(ex), failureNode.SelectSingleNode("message").InnerText);
            Assert.Equal(ExceptionUtility.GetStackTrace(ex), failureNode.SelectSingleNode("stack-trace").InnerText);
        }
Example #30
0
    // delete user
    public Boolean DeleteUser(int studentId)
    {
        Boolean status = false;

        try
        {
            DBConnection.conn.Open();
            String     query = "DELETE FROM dbo.IlmpUser WHERE StudentID=@StudentId";
            SqlCommand cmd   = new SqlCommand(query, DBConnection.conn);
            cmd.Parameters.AddWithValue("@StudentId", studentId);
            cmd.ExecuteNonQuery();
            int result = cmd.ExecuteNonQuery();
            if (result > 0)
            {
                status = true;
            }
        }
        catch (SqlException ex)
        {
            ExceptionUtility.LogException(ex, "Error Page");
            throw new CustomException(ApplicationConstants.UnhandledException + ": " + ex.Message);
        }
        catch (Exception ex)
        {
            ExceptionUtility.LogException(ex, "Error Page");
            throw new CustomException(ApplicationConstants.UnhandledException + ": " + ex.Message);
        }
        finally
        {
            if (DBConnection.conn != null)
            {
                DBConnection.conn.Close();
            }
        }
        return(status);
    }