Exemple #1
0
        public void ExecuteAssert <TCheckResult>(Func <T, TCheckResult> action, Func <T, IErrorMessageBuilder, TCheckResult, IErrorMessageBuilder> messageBuilder) where TCheckResult : ICheckResult
        {
            TCheckResult lastResult = default(TCheckResult);

            Waiter.Wait(() =>
            {
                lastResult = action(subject);
                return(lastResult.Valid);
            }, (timeout, exception) =>
            {
                IErrorMessageBuilder m = new ErrorMessageBuilder();
                m.WithSubject(subject).WithTimeout(timeout);
                if (exception != null)
                {
                    var notFoundException = exception as ElementNotFoundException;
                    if (notFoundException != null)
                    {
                        m = messageBuilder(notFoundException.Control as T, m, lastResult);
                        m.WithFailedToFindControl(notFoundException);
                    }
                    else
                    {
                        throw new Exception($"Невозможно построить сообщений об ошибке. Произошла непредвиденная ошибка: {exception}", exception);
                    }
                }
                else
                {
                    m = messageBuilder(subject, m, lastResult);
                }

                return(m.Build());
            }, WaitInterval);
        }
Exemple #2
0
        public string Put(UserViewModel userViewModel)
        {
            User _user = mapper.Map <User>(userViewModel);

            User user = this.userRepository.Find(x => x.Id == userViewModel.Id && !x.IsDeleted);

            if (user is null)
            {
                return(JsonConvert.SerializeObject("User not found."));
            }

            bool ignorePasswordUpdate = false;

            if (string.IsNullOrEmpty(userViewModel.Password) && userViewModel.Password == userViewModel.ConfirmPassword)
            {
                ignorePasswordUpdate = true;
            }

            var errors = new ErrorMessageBuilder().IsItOk(_user, userViewModel.ConfirmPassword, ignorePasswordUpdate);

            if (errors.Any())
            {
                return(JsonConvert.SerializeObject(errors));
            }

            user.Name        = userViewModel.Name;
            user.Email       = userViewModel.Email;
            user.DateUpdated = DateTime.UtcNow;
            user.Password    = userViewModel.Password;

            this.userRepository.Update(user);

            return(JsonConvert.SerializeObject("That's nice. The user has been updated succesfully."));
        }
Exemple #3
0
        public IActionResult GetAllErrorMessages()
        {
            // Get error messages
            var errorMessages = ErrorMessageBuilder.BuildErrorMessages();

            // Return
            return(Ok(errorMessages));
        }
Exemple #4
0
        public bool StringIsNullOrEmpty(string data)
        {
            var result = string.IsNullOrEmpty(data);

            if (result)
            {
                ErrorMessageBuilder.Append("Data is can not be blank \n");
                ErrorMessage = ErrorMessageBuilder.ToString();
            }

            return(result);
        }
        private static void OnUnhandledExceptionEvent(object sender, UnhandledExceptionEventArgs e)
        {
            var exception = e.ExceptionObject as Exception;

            if (exception != null)
            {
                ErrorLogFile.Instance.WriteLine(
                    ErrorMessageBuilder.BuildExceptionMessage(
                        exception,
                        "Unhandled Framework Exception"));
            }

            InvokeUnhandledExceptionMode(sender, new UnhandledFrameworkExceptionEventArgs(exception));
        }
Exemple #6
0
        /// <summary>
        /// Prompts the user with an error
        /// </summary>
        /// <param name="exception">exception describing the error details</param>
        /// <param name="message">message to prompt</param>
        /// <param name="caption">caption or subject</param>
        /// <param name="beep">Set to <c>true</c> to play a message beep, otherwise <c>false</c></param>
        public static void ShowErrorDialog(Exception exception, string message, string caption, bool beep)
        {
            if (beep)
            {
                Notifications.ErrorBeep();
            }

            FullScreenMessageBox.Show(
                ErrorMessageBuilder.BuildExceptionMessage(exception, message),
                caption,
                MessageBoxButtons.OK,
                MessageBoxIcon.Exclamation,
                MessageBoxDefaultButton.Button1);
        }
Exemple #7
0
        public bool IsExistedStudentId(string studentId)
        {
            StudentId = studentId;

            FaceIOContext context = new FaceIOContext();

            var result = context.Student.Where(x => x.Id == StudentId).FirstOrDefault() != null;

            if (!result)
            {
                ErrorMessageBuilder.Append("Student ID is not found \n");
                ErrorMessage = ErrorMessageBuilder.ToString();
            }

            return(result);
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Boolean isTrue = objLoginBR.PasswordConfirmation(Convert.ToInt32(Session["UserId"]), txtOldPassword.Text.Trim());

            if (!isTrue)
            {
                lblMessage.Text     = "Old Password is incorrect";
                lblMessage.CssClass = "WarningText";
                return;
            }

            objLoginBR.UpdateLoginPassword(Convert.ToInt32(Session["UserId"]), txtNewPassword.Text.Trim());
            ErrorMessage        = ErrorMessageBuilder.BuildMessage(MessageKeys.RecordUpdate);
            lblMessage.Text     = ErrorMessage;
            lblMessage.CssClass = "ConfirmText";
        }
Exemple #9
0
        public bool IsExistedUsername(string username)
        {
            Username = username;

            FaceIOContext context = new FaceIOContext();

            var result = context.Users.Where(x => x.Username == Username).FirstOrDefault() != null;

            if (!result)
            {
                ErrorMessageBuilder.Append("Username is not found \n");
                ErrorMessage = ErrorMessageBuilder.ToString();
            }

            return(result);
        }
Exemple #10
0
        public bool IsExistedTeacherId(string teacherId)
        {
            TeacherId = teacherId;

            FaceIOContext context = new FaceIOContext();

            var result = context.Teacher.Where(x => x.Id == TeacherId).FirstOrDefault() != null;

            if (!result)
            {
                ErrorMessageBuilder.Append("Teacher Id is not found \n");
                ErrorMessage = ErrorMessageBuilder.ToString();
            }

            return(result);
        }
Exemple #11
0
        public async Task <IdentityResult> Register(User user, string password)
        {
            try
            {
                var identityResult = await _userRepository.Register(user, password);
                await SetForumUserRole(user);

                return(identityResult);
            }
            catch (DbEntityValidationException ex)
            {
                throw new ServerValidationException(ErrorMessageBuilder.BuildErrorMessage("Registration failed due to these issues: ", ex.EntityValidationErrors), ServerValidationException.ServerValidationExceptionType.Error);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #12
0
        protected void GridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int ID = 0;

            if (e.CommandName == "View")
            {
                ID = Int32.Parse(e.CommandArgument.ToString());
                Response.Redirect("Voucher.aspx?Mode=View&ID=" + ID);
            }
            else if (e.CommandName == "Edt")
            {
                ID = Int32.Parse(e.CommandArgument.ToString());

                //DataTable dt = objVoucherBR.OrderExistinConfirm(ID);
                //if (dt.Rows.Count > 0)
                //{
                //    lblMessage.Text = "Cannot edit this record, Order Requisition exist in Confirmation";
                //    lblMessage.CssClass = "WarningText";
                //    return;
                //}

                Response.Redirect("Voucher.aspx?Mode=Edit&ID=" + ID);
            }
            else if (e.CommandName == "Del")
            {
                ID = Int32.Parse(e.CommandArgument.ToString());

                //DataTable dt = objVoucherBR.OrderExistinConfirm(ID);
                //if (dt.Rows.Count > 0)
                //{
                //    lblMessage.Text = "Cannot delete this record, Order Requisition exist in Confirmation";
                //    lblMessage.CssClass = "WarningText";
                //    return;
                //}

                objVoucherBR.DeleteMasterDetailRecord(ID);
                ErrorMessage        = ErrorMessageBuilder.BuildMessage(MessageKeys.RecordDelete);
                lblMessage.Text     = ErrorMessage;
                lblMessage.CssClass = "ConfirmText";
                GetGridData();
            }
        }
Exemple #13
0
        public string Post(UserViewModel userViewModel)
        {
            User _user = mapper.Map <User>(userViewModel);

            var errors = new ErrorMessageBuilder().IsItOk(_user, userViewModel.ConfirmPassword);

            if (errors.Any())
            {
                var errorsList = new ErrorMessage();
                errorsList.Errors = errors;

                return(JsonConvert.SerializeObject(errorsList));
            }

            _user.DateCreated = DateTime.UtcNow;

            _user.Password = authService.EncryptPassword(_user.Password);

            this.userRepository.Create(_user);

            return(JsonConvert.SerializeObject("That's nice. The user has been added succesfully."));
        }
        public async Task <IHttpActionResult> Post(UserViewmodel user)
        {
            try
            {
                var identityResult = await _registerFacade.Register(user, user.Password);

                if (identityResult.Succeeded)
                {
                    return(Ok("Registration successful!"));
                }
                else
                {
                    return(BadRequest(ErrorMessageBuilder.BuildErrorMessage("Registration failed: ", identityResult.Errors)));
                }
            }
            catch (ServerValidationException serverExc)
            {
                return(BadRequest(serverExc.Message));
            }
            catch (Exception ex)
            {
                return(BadRequest($"Something unexpected happened: {ex.Message}. Try to reload this page."));
            }
        }
        protected void GridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int ID = 0;

            if (e.CommandName == "View")
            {
                ID = Int32.Parse(e.CommandArgument.ToString());
                Response.Redirect("PaymentVoucherSingle.aspx?Mode=View&ID=" + ID);
            }
            else if (e.CommandName == "Edt")
            {
                ID = Int32.Parse(e.CommandArgument.ToString());
                Response.Redirect("PaymentVoucherSingle.aspx?Mode=Edit&ID=" + ID);
            }
            else if (e.CommandName == "Del")
            {
                ID = Int32.Parse(e.CommandArgument.ToString());
                objPaymentVoucherBR.DeleteMasterDetailRecord(ID);
                ErrorMessage        = ErrorMessageBuilder.BuildMessage(MessageKeys.RecordDelete);
                lblMessage.Text     = ErrorMessage;
                lblMessage.CssClass = "ConfirmText";
                GetGridData();
            }
        }
 public GameEngineService(ErrorMessageBuilder errorMessageBuilder)
 {
     _errorMessageBuilder = errorMessageBuilder ?? throw new ArgumentNullException(nameof(errorMessageBuilder));
 }
 public ConfigurationService(FileInfo configFileInfo, ErrorMessageBuilder errorMessageBuilder)
 {
     _configFileInfo      = configFileInfo ?? throw new ArgumentNullException(nameof(configFileInfo));
     _errorMessageBuilder = errorMessageBuilder ?? throw new ArgumentNullException(nameof(errorMessageBuilder));
 }
Exemple #18
0
        public async Task LoginControllerPostReturns400()
        {
            string[] errors            = { "Username already exist." };
            string   loginErrorMessage = "Login failed due to these issues: ";

            IHttpActionResult httpActionResult;

            _loginFacadeMock.Setup(x => x.Validate(It.IsAny <string>(), It.IsAny <string>())).Throws(new ServerValidationException(ErrorMessageBuilder.BuildErrorMessage(loginErrorMessage, errors), ServerValidationException.ServerValidationExceptionType.Error));
            httpActionResult = await _sut.Post(_user);

            httpActionResult.Should().BeOfType <BadRequestErrorMessageResult>();
        }
        private void InsertData(int isSave)
        {
            ArrayList inputArrList = new ArrayList();

            try
            {
                lblMessage.Text = string.Empty;

                if (!objPaymentVoucherBR.GetAccountNameIdExist(Convert.ToInt32(hfAccountAutoCompleted.Value), txtAccountTitle.Text.Trim()))
                {
                    ErrorMessage        = "Cash / Bank Account Title / Code does not exist in data base";
                    lblMessage.Text     = ErrorMessage;
                    lblMessage.CssClass = "WarningText";
                    ddlVoucherType.Focus();
                    return;
                }

                if (!objPaymentVoucherBR.GetAccountNameIdExist(Convert.ToInt32(hfPartyAccountAutoCompleted.Value), txtPartyAccountTitle.Text.Trim()))
                {
                    ErrorMessage        = "Party Account Title / Code does not exist in data base";
                    lblMessage.Text     = ErrorMessage;
                    lblMessage.CssClass = "WarningText";
                    ddlVoucherType.Focus();
                    return;
                }

                if (Convert.ToDecimal(txtAmount.Text) <= 0)
                {
                    ErrorMessage        = "Amount should be greater then zero";
                    lblMessage.Text     = ErrorMessage;
                    lblMessage.CssClass = "WarningText";
                    ddlVoucherType.Focus();
                    return;
                }

                if (HiddenFieldMode.Value == "New")
                {
                    inputArrList.Add(txtVoucherDate.Text.Trim());
                    inputArrList.Add(ddlVoucherType.SelectedValue);
                    inputArrList.Add(txtNarration.Text.Trim().ToUpper());
                    inputArrList.Add(txtChequeNo.Text.Trim().ToUpper());
                    inputArrList.Add(txtChequeDate.Text.Trim());
                    int VoucherId = objPaymentVoucherBR.InsertMasterRecord(inputArrList);

                    // Save Debit (Party Account Code)
                    inputArrList.Clear();
                    inputArrList.Add(VoucherId);
                    inputArrList.Add(hfPartyAccountAutoCompleted.Value);
                    inputArrList.Add(txtAmount.Text);
                    inputArrList.Add(0);
                    inputArrList.Add("D");
                    objPaymentVoucherBR.InsertDetailRecord(inputArrList);

                    // Save Credit (Bank & Cash Account Code)
                    inputArrList.Clear();
                    inputArrList.Add(VoucherId);
                    inputArrList.Add(hfAccountAutoCompleted.Value);
                    inputArrList.Add(0);
                    inputArrList.Add(txtAmount.Text);
                    inputArrList.Add("C");
                    objPaymentVoucherBR.InsertDetailRecord(inputArrList);

                    ErrorMessage = ErrorMessageBuilder.BuildMessage(MessageKeys.RecordSave);
                    javaScriptCall(ErrorMessage);
                }
                else if (HiddenFieldMode.Value == "Edit")
                {
                    inputArrList.Add(HiddenFieldID.Value);
                    inputArrList.Add(txtVoucherDate.Text.Trim());
                    inputArrList.Add(ddlVoucherType.SelectedValue);
                    inputArrList.Add(txtNarration.Text.Trim().ToUpper());
                    inputArrList.Add(txtChequeNo.Text.Trim().ToUpper());
                    inputArrList.Add(txtChequeDate.Text.Trim());
                    objPaymentVoucherBR.UpdateMasterRecord(inputArrList);

                    objPaymentVoucherBR.DeleteDetailRecord(Convert.ToInt32(HiddenFieldID.Value));

                    // Save Debit (Party Account Code)
                    inputArrList.Clear();
                    inputArrList.Add(HiddenFieldID.Value);
                    inputArrList.Add(hfPartyAccountAutoCompleted.Value);
                    inputArrList.Add(txtAmount.Text);
                    inputArrList.Add(0);
                    inputArrList.Add("D");
                    objPaymentVoucherBR.InsertDetailRecord(inputArrList);

                    // Save Credit (Bank & Cash Account Code)
                    inputArrList.Clear();
                    inputArrList.Add(HiddenFieldID.Value);
                    inputArrList.Add(hfAccountAutoCompleted.Value);
                    inputArrList.Add(0);
                    inputArrList.Add(txtAmount.Text);
                    inputArrList.Add("C");
                    objPaymentVoucherBR.InsertDetailRecord(inputArrList);

                    ErrorMessage = ErrorMessageBuilder.BuildMessage(MessageKeys.RecordUpdate);
                    javaScriptCall(ErrorMessage);
                }

                if (isSave == 0)
                {
                    Response.Redirect("PaymentVoucherSingleList.aspx");
                }

                ClearControl();
            }
            catch (Exception exe)
            {
                javaScriptCall(exe.Message);
            }
        }
Exemple #20
0
        public async Task LoginControllerPostReturns400WithCorrectErrorMessageServerValidationException()
        {
            string[] errors            = { "Username already exist." };
            var      loginErrorMessage = "Login failed due to these issues: ";
            var      spaces            = "\r\n\r\n";

            IHttpActionResult httpActionResult;

            _loginFacadeMock.Setup(x => x.Validate(It.IsAny <string>(), It.IsAny <string>())).Throws(new ServerValidationException(ErrorMessageBuilder.BuildErrorMessage(loginErrorMessage, errors), ServerValidationException.ServerValidationExceptionType.Error));
            httpActionResult = await _sut.Post(_user);

            var badRequest = httpActionResult as BadRequestErrorMessageResult;

            badRequest.Message.Should().BeEquivalentTo(loginErrorMessage + spaces + errors[0]);
        }
Exemple #21
0
        private void InsertData(int isSave)
        {
            int  AccountId = 0;
            bool isExist   = objCOABR.AccountNameAlredayExist(Convert.ToInt32(HiddenFieldID.Value), Convert.ToInt32(ddlBranch.SelectedValue), txtAccountName.Text.Trim());

            if (isExist)
            {
                ErrorMessage = "Account Name Alreday Exist";
                javaScriptCall(ErrorMessage);
                return;
            }

            if (HiddenFieldAccountId.Value == string.Empty || HiddenFieldAccountId.Value == "0")
            {
                ErrorMessage = "You need to select a node First";
                javaScriptCall(ErrorMessage);
                return;
            }

            if (ddlBranch.SelectedValue != "0")
            {
                bool InvalidLocation = false;
                foreach (GridViewRow gRow in LocationGridView.Rows)
                {
                    bool chkAppeared = ((CheckBox)gRow.Controls[0].FindControl("chkAppeared")).Checked;
                    if (chkAppeared.Equals(true))
                    {
                        InvalidLocation = true;
                        break;
                    }
                }

                if (!InvalidLocation)
                {
                    javaScriptCall("Before Saving, There should be at least one record selected in Location List.");
                    txtAccountName.Focus();
                    return;
                }
            }

            if (txtParentAccountCode.Text.Trim().Length > 200)
            {
                ErrorMessage = "Account Code exceeds to 200-Character.";
                javaScriptCall(ErrorMessage);
                return;
            }

            string NewCOA = "", ParentAccountCode = "", ParentId = "";

            //string[] splitAccoutCode = txtParentAccountCode.Text.Trim().Split('-');
            //if (splitAccoutCode.Length > 1)
            //{
            //    for (int Count = 1; Count < splitAccoutCode.Length; Count++)
            //    {
            //        if (ParentAccountCode.Length > 0) ParentAccountCode += "-";
            //        ParentAccountCode += splitAccoutCode[Count];
            //    }
            //}
            //else
            //    ParentAccountCode = txtParentAccountCode.Text.Trim();

            ParentAccountCode = txtParentAccountCode.Text.Trim();
            ParentId          = HiddenFieldAccountId.Value.ToString();

            ArrayList inputArrList = new ArrayList();

            try
            {
                if (HiddenFieldMode.Value == "New")
                {
                    //if (txtParentAccountCode.Text.Trim().Length > 8)
                    //{
                    //    ErrorMessage = "Only 4th level account create";
                    //    javaScriptCall(ErrorMessage);
                    //    return;
                    //}

                    inputArrList.Add(ParentAccountCode);
                    inputArrList.Add(txtAccountName.Text.Trim().ToUpper());
                    inputArrList.Add(ParentId);
                    inputArrList.Add(0);        // Old Opening Balance
                    inputArrList.Add(ddlBranch.SelectedValue);
                    AccountId = objCOABR.InsertRecord(inputArrList, out NewCOA);

                    foreach (GridViewRow gRow in LocationGridView.Rows)
                    {
                        inputArrList.Clear();
                        string txtOpeningBalance = ((TextBox)gRow.Controls[0].FindControl("txtOpeningBalance")).Text;
                        string hfLocationId      = ((HiddenField)gRow.Controls[0].FindControl("hfLocationId")).Value;
                        bool   chkAppeared       = ((CheckBox)gRow.Controls[0].FindControl("chkAppeared")).Checked;

                        txtOpeningBalance = txtOpeningBalance.Equals("") ? "0" : txtOpeningBalance;

                        if (chkAppeared.Equals(true))
                        {
                            inputArrList.Add(AccountId);
                            inputArrList.Add(hfLocationId);
                            inputArrList.Add(txtOpeningBalance);
                            inputArrList.Add(chkAppeared);
                            objCOABR.InsertCOALocationDetailRecord(inputArrList);
                        }
                    }
                }
                else if (HiddenFieldMode.Value == "Edit")
                {
                    AccountId = Convert.ToInt32(HiddenFieldID.Value);
                    inputArrList.Add(AccountId);
                    inputArrList.Add(txtAccountName.Text.Trim().ToUpper());
                    objCOABR.UpdateRecord(inputArrList);

                    foreach (GridViewRow gRow in LocationGridView.Rows)
                    {
                        inputArrList.Clear();
                        string txtOpeningBalance = ((TextBox)gRow.Controls[0].FindControl("txtOpeningBalance")).Text;
                        string hfLocationId      = ((HiddenField)gRow.Controls[0].FindControl("hfLocationId")).Value;
                        bool   chkAppeared       = ((CheckBox)gRow.Controls[0].FindControl("chkAppeared")).Checked;

                        txtOpeningBalance = txtOpeningBalance.Equals("") ? "0" : txtOpeningBalance;

                        inputArrList.Add(AccountId);
                        inputArrList.Add(hfLocationId);
                        inputArrList.Add(txtOpeningBalance);
                        inputArrList.Add(chkAppeared);

                        DataTable dataTableCOA = objCOABR.GetLocationCOA(AccountId, Convert.ToInt32(hfLocationId));
                        if (dataTableCOA.Rows.Count > 0)
                        {
                            objCOABR.UpdateCOALocationDetailRecord(inputArrList);
                        }
                        else
                        {
                            if (chkAppeared.Equals(true))
                            {
                                objCOABR.InsertCOALocationDetailRecord(inputArrList);
                            }
                        }
                    }
                }

                string AccountName = txtAccountName.Text.Trim().ToUpper();

                if (ddlBranch.SelectedValue != "0")
                {
                    AccountName += " (" + objCOABR.GetBranchName(Convert.ToInt32(ddlBranch.SelectedValue)) + ")";
                }

                if (HiddenFieldMode.Value == "New")
                {
                    AddSingleNodeList(AccountId, NewCOA, AccountName);

                    ErrorMessage = ErrorMessageBuilder.BuildMessage(MessageKeys.RecordSave);
                    javaScriptCall(ErrorMessage);
                }
                else if (HiddenFieldMode.Value == "Edit")
                {
                    tvCOA.SelectedNode.Text = AccountName;
                    ErrorMessage            = ErrorMessageBuilder.BuildMessage(MessageKeys.RecordUpdate);
                    javaScriptCall(ErrorMessage);
                }

                ClearControl();
                GetLocations(Convert.ToInt32(ddlBranch.SelectedValue));
                txtAccountName.Focus();
            }
            catch (Exception exe)
            {
                lblMessage.Text     = exe.Message;
                lblMessage.CssClass = "WarningText";
            }
        }
        private void InsertData(int isSave)
        {
            ArrayList inputArrList = new ArrayList();

            try
            {
                if (OrderDetailDataTable.Rows.Count < 1)
                {
                    lblMessage.Text     = "Before Saving, There should be at least one record in list";
                    lblMessage.CssClass = "WarningText";
                    ddlVoucherType.Focus();
                    return;
                }

                if (Convert.ToDecimal(txtDifference.Text) != 0)
                {
                    ErrorMessage        = "Total Debit must be equal to Total Credit";
                    lblMessage.Text     = ErrorMessage;
                    lblMessage.CssClass = "WarningText";
                    ddlVoucherType.Focus();
                    return;
                }

                if (HiddenFieldMode.Value == "New")
                {
                    inputArrList.Add(txtVoucherDate.Text.Trim());
                    inputArrList.Add(ddlVoucherType.SelectedValue);
                    inputArrList.Add(txtNarration.Text.Trim().ToUpper());
                    int VoucherId = objVoucherBR.InsertMasterRecord(inputArrList);

                    foreach (DataRow dtRow in OrderDetailDataTable.Rows)
                    {
                        inputArrList.Clear();
                        inputArrList.Add(VoucherId);
                        inputArrList.Add(dtRow["AccountId"].ToString());

                        if (dtRow["TotalDebit"].ToString() != "")
                        {
                            inputArrList.Add(dtRow["TotalDebit"].ToString());
                        }
                        else
                        {
                            inputArrList.Add("0");
                        }

                        if (dtRow["TotalCredit"].ToString() != "")
                        {
                            inputArrList.Add(dtRow["TotalCredit"].ToString());
                        }
                        else
                        {
                            inputArrList.Add("0");
                        }

                        inputArrList.Add(dtRow["Narration"].ToString());
                        objVoucherBR.InsertDetailRecord(inputArrList);
                    }
                }
                else if (HiddenFieldMode.Value == "Edit")
                {
                    inputArrList.Add(HiddenFieldID.Value);
                    inputArrList.Add(txtVoucherDate.Text.Trim());
                    inputArrList.Add(ddlVoucherType.SelectedValue);
                    inputArrList.Add(txtNarration.Text.Trim().ToUpper());
                    objVoucherBR.UpdateMasterRecord(inputArrList);

                    objVoucherBR.DeleteDetailRecord(Convert.ToInt32(HiddenFieldID.Value));

                    foreach (DataRow dtRow in OrderDetailDataTable.Rows)
                    {
                        inputArrList.Clear();
                        inputArrList.Add(HiddenFieldID.Value);
                        inputArrList.Add(dtRow["AccountId"].ToString());

                        if (dtRow["TotalDebit"].ToString() != "")
                        {
                            inputArrList.Add(dtRow["TotalDebit"].ToString());
                        }
                        else
                        {
                            inputArrList.Add("0");
                        }

                        if (dtRow["TotalCredit"].ToString() != "")
                        {
                            inputArrList.Add(dtRow["TotalCredit"].ToString());
                        }
                        else
                        {
                            inputArrList.Add("0");
                        }

                        inputArrList.Add(dtRow["Narration"].ToString());
                        objVoucherBR.InsertDetailRecord(inputArrList);
                    }
                }
                if (HiddenFieldMode.Value == "New")
                {
                    ErrorMessage = ErrorMessageBuilder.BuildMessage(MessageKeys.RecordSave);
                    javaScriptCall(ErrorMessage);
                }
                else if (HiddenFieldMode.Value == "Edit")
                {
                    ErrorMessage = ErrorMessageBuilder.BuildMessage(MessageKeys.RecordUpdate);
                    javaScriptCall(ErrorMessage);
                }

                if (isSave == 0)
                {
                    Response.Redirect("VoucherList.aspx");
                }

                ClearControl();
            }
            catch (Exception exe)
            {
                javaScriptCall(exe.Message);
            }
        }