private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                bValidation = false;
                BeforeUpdate();
                if (bValidation == false)
                {
                    MASTERMEMBER mmMst   = (from mas in db.MASTERMEMBERs where mas.MEMBER_CODE == dMember_Code select mas).FirstOrDefault();
                    var          OldData = new JSonHelper().ConvertObjectToJSon(mmMst);
                    mmMst.Tdf_PaymentDate = Convert.ToDateTime(dtpPaymentDate.SelectedDate);
                    mmMst.TDF_AMOUNT      = Convert.ToDecimal(txtAmount.Text);
                    db.SaveChanges();

                    var NewData = new JSonHelper().ConvertObjectToJSon(mmMst);
                    AppLib.EventHistory(this.Tag.ToString(), 1, OldData, NewData, "MASTERMEMBER", "TDF MANUAL ENTRY");
                    MessageBox.Show("Saved Sucessfully");
                    fClear();
                }
            }
            catch (Exception ex)
            {
                ExceptionLogging.SendErrorToText(ex);
            }
        }
Beispiel #2
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (ID != 0)
                {
                    if (MessageBox.Show("Do you want to Delete this '" + txtNubeBranch.Text + "'", "DELETE", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        MASTERNUBEBRANCH ms = db.MASTERNUBEBRANCHes.Where(x => x.NUBE_BRANCH_CODE == ID).FirstOrDefault();
                        var OldData         = new JSonHelper().ConvertObjectToJSon(ms);

                        db.MASTERNUBEBRANCHes.Remove(ms);
                        db.SaveChanges();

                        AppLib.EventHistory(this.Tag.ToString(), 2, OldData, "", "MASTERNUBEBRANCH");
                        MessageBox.Show("Deleted Successfully!", "DELETED", MessageBoxButton.OK, MessageBoxImage.Information);
                        FormClear();
                    }
                }
                else
                {
                    MessageBox.Show("Please Select Any NUBE Branch! (Double Click to Select)");
                }
            }
            catch (Exception ex)
            {
                Nube.ExceptionLogging.SendErrorToText(ex);
            }
        }
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (ID != 0)
                {
                    if (MessageBox.Show("Do you want to delete '" + txtStateName.Text + "'", "DELETE", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                    {
                        MASTERSTATE c       = db.MASTERSTATEs.Where(x => x.STATE_CODE == ID).FirstOrDefault();
                        var         OldData = new JSonHelper().ConvertObjectToJSon(c);

                        db.MASTERSTATEs.Remove(c);
                        db.SaveChanges();

                        AppLib.EventHistory(this.Tag.ToString(), 2, OldData, "", "MASTERSTATE");
                        MessageBox.Show("Deleted Successfully", "DELETED", MessageBoxButton.OK, MessageBoxImage.Information);
                        FormClear();
                    }
                }
                else
                {
                    MessageBox.Show("Please Select Any State! (Double Click to Select)", "SELECT", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
            catch (Exception ex)
            {
                Nube.ExceptionLogging.SendErrorToText(ex);
            }
        }
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (ID != 0)
                {
                    var s = txtBankName.Text;
                    if (MessageBox.Show("Do you want to Delete '" + s + "'?", "Delete Confirmation", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        decimal    i       = Convert.ToDecimal(ID);
                        MASTERBANK mb      = db.MASTERBANKs.Where(x => x.BANK_CODE == ID).FirstOrDefault();
                        var        OldData = new JSonHelper().ConvertObjectToJSon(mb);
                        db.MASTERBANKs.Remove(mb);
                        db.SaveChanges();

                        AppLib.EventHistory(this.Tag.ToString(), 2, OldData, "", "MASTERBANK");
                        MessageBox.Show("Deleted Successfully");
                        ClearForm();
                        LoadWindow();
                    }
                }
                else
                {
                    MessageBox.Show("Please Select Any Bank! (Double Click to Select)");
                }
            }
            catch (Exception ex)
            {
                Nube.ExceptionLogging.SendErrorToText(ex);
            }
        }
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (txtCountry.Text == "")
                {
                    MessageBox.Show("No record to delete", "DELETE", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
                else
                {
                    if (MessageBox.Show("Do you want to delete '" + txtCountry.Text + "'?", "DELETE CONFIRMATION", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                    {
                        CountrySetup c       = db.CountrySetups.Where(x => x.ID == ID).FirstOrDefault();
                        var          OldData = new JSonHelper().ConvertObjectToJSon(c);

                        db.CountrySetups.Remove(c);
                        db.SaveChanges();

                        AppLib.EventHistory(this.Tag.ToString(), 2, OldData, "", "CountrySetup");
                        MessageBox.Show("Deleted Successfully", "DELETED", MessageBoxButton.OK, MessageBoxImage.Information);
                        FormClear();
                    }
                }
            }
            catch (Exception ex)
            {
                Nube.ExceptionLogging.SendErrorToText(ex);
            }
        }
Beispiel #6
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (iID == 1)
                {
                    MessageBox.Show("You Can't Delete This User! , Contact Administrator!", "User Restricted!", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else if (iID != 0)
                {
                    if (MessageBox.Show("Do you want to delete '" + txtUserName.Text + "'", "DELETE", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                    {
                        UserAccount usc     = (from x in db.UserAccounts where x.UserId == iID select x).FirstOrDefault();
                        var         OldData = new JSonHelper().ConvertObjectToJSon(usc);

                        db.UserAccounts.Remove(usc);
                        db.SaveChanges();

                        AppLib.EventHistory(this.Tag.ToString(), 2, OldData, "", "UserAccount");
                        MessageBox.Show("Deleted Successfully", "DELETED", MessageBoxButton.OK, MessageBoxImage.Information);
                        fClear();
                    }
                }
                else
                {
                    MessageBox.Show("Please Select Any User! (Double Click to Select)", "SELECT", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
            catch (Exception ex)
            {
                Nube.ExceptionLogging.SendErrorToText(ex);
            }
        }
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (cmbCountry.Text == "")
                {
                    MessageBox.Show("Enter Bank..", "Information");
                }

                else if (txtStateName.Text == "")
                {
                    MessageBox.Show("Enter Branchcode..", "Information");
                }

                else
                {
                    if (MessageBox.Show("Do you want to save this record?", "SAVE", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        if (ID != 0)
                        {
                            decimal     id      = (decimal)ID;
                            var         s       = cmbCountry.Text.ToString();
                            MASTERSTATE mb      = db.MASTERSTATEs.Where(x => x.STATE_CODE == id).FirstOrDefault();
                            var         OldData = new JSonHelper().ConvertObjectToJSon(mb);

                            mb.Country    = Convert.ToDecimal(cmbCountry.SelectedValue);
                            mb.STATE_NAME = txtStateName.Text;

                            db.SaveChanges();
                            AppLib.lstMASTERSTATE = db.MASTERSTATEs.OrderBy(x => x.STATE_NAME).ToList();

                            var NewData = new JSonHelper().ConvertObjectToJSon(mb);
                            AppLib.EventHistory(this.Tag.ToString(), 1, OldData, NewData, "MASTERSTATE");
                            MessageBox.Show("Saved Successfully", "Saved");
                            FormClear();
                        }
                        else
                        {
                            MASTERSTATE mb = new MASTERSTATE();
                            mb.Country    = Convert.ToDecimal(cmbCountry.SelectedValue);
                            mb.STATE_NAME = txtStateName.Text;

                            db.MASTERSTATEs.Add(mb);
                            db.SaveChanges();
                            AppLib.lstMASTERSTATE = db.MASTERSTATEs.OrderBy(x => x.STATE_NAME).ToList();

                            var NewData = new JSonHelper().ConvertObjectToJSon(mb);
                            AppLib.EventHistory(this.Tag.ToString(), 0, "", NewData, "MASTERSTATE");
                            MessageBox.Show("Saved Successfully", "Saved");
                            FormClear();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Nube.ExceptionLogging.SendErrorToText(ex);
            }
        }
Beispiel #8
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (txtPersonTitle.Text == "")
                {
                    MessageBox.Show("Enter Title...", "Information", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtPersonTitle.Focus();
                }
                else
                {
                    if (MessageBox.Show("Do you want to save this record?", "SAVE CONFIRMATION", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                    {
                        if (ID != 0)
                        {
                            NameTitleSetup ms      = db.NameTitleSetups.Where(x => x.ID == ID).FirstOrDefault();
                            var            OldData = new JSonHelper().ConvertObjectToJSon(ms);

                            ms.TitleName = txtPersonTitle.Text;
                            db.SaveChanges();
                            AppLib.lstNameTitleSetup = db.NameTitleSetups.ToList();

                            var NewData = new JSonHelper().ConvertObjectToJSon(ms);
                            AppLib.EventHistory(this.Tag.ToString(), 1, OldData, NewData, "NameTitleSetup");
                            MessageBox.Show("Saved Successfully!", "SAVED", MessageBoxButton.OK, MessageBoxImage.Information);
                            FormClear();
                        }
                        else
                        {
                            var pt = (from p in db.NameTitleSetups where p.TitleName == txtPersonTitle.Text select p).SingleOrDefault();
                            if (pt != null)
                            {
                                MessageBox.Show("'" + txtPersonTitle.Text + "' Already exist.Enter new Title.", "Information", MessageBoxButton.OK, MessageBoxImage.Error);
                                txtPersonTitle.Focus();
                            }
                            else
                            {
                                NameTitleSetup ms = new NameTitleSetup();
                                ms.TitleName = txtPersonTitle.Text;
                                db.NameTitleSetups.Add(ms);
                                db.SaveChanges();
                                AppLib.lstNameTitleSetup = db.NameTitleSetups.ToList();

                                var NewData = new JSonHelper().ConvertObjectToJSon(ms);
                                AppLib.EventHistory(this.Tag.ToString(), 0, "", NewData, "NameTitleSetup");
                                MessageBox.Show("Saved Successfully!", "SAVED", MessageBoxButton.OK, MessageBoxImage.Information);
                                FormClear();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Nube.ExceptionLogging.SendErrorToText(ex);
            }
        }
Beispiel #9
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (txtCity.Text == "")
                {
                    MessageBox.Show("Enter City...", "Information", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }

                else if (cmbState.Text == "")
                {
                    MessageBox.Show("Enter State...", "Information", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
                else
                {
                    if (MessageBox.Show("Do you wanrt to save this record?", "SAVE CONFIRMATION", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        if (ID != 0)
                        {
                            MASTERCITY c       = db.MASTERCITies.Where(x => x.CITY_CODE == ID).FirstOrDefault();
                            var        OldData = new JSonHelper().ConvertObjectToJSon(c);

                            c.CITY_NAME  = txtCity.Text;
                            c.STATE_CODE = Convert.ToDecimal(cmbState.SelectedValue);
                            db.SaveChanges();
                            AppLib.lstMASTERCITY = db.MASTERCITies.OrderBy(x => x.CITY_NAME).ToList();

                            var NewData = new JSonHelper().ConvertObjectToJSon(c);
                            AppLib.EventHistory(this.Tag.ToString(), 1, OldData, NewData, "MASTERCITY");

                            MessageBox.Show("Saved Successfully!", "Saved", MessageBoxButton.OK, MessageBoxImage.Information);
                            FormClear();
                        }
                        else
                        {
                            MASTERCITY c = new MASTERCITY();
                            c.CITY_NAME  = txtCity.Text;
                            c.STATE_CODE = Convert.ToDecimal(cmbState.SelectedValue);
                            db.MASTERCITies.Add(c);
                            db.SaveChanges();
                            AppLib.lstMASTERCITY = db.MASTERCITies.OrderBy(x => x.CITY_NAME).ToList();

                            var NewData = new JSonHelper().ConvertObjectToJSon(c);
                            AppLib.EventHistory(this.Tag.ToString(), 0, "", NewData, "MASTERCITY");

                            MessageBox.Show("Saved Successfully!", "Saved", MessageBoxButton.OK, MessageBoxImage.Information);
                            FormClear();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Nube.ExceptionLogging.SendErrorToText(ex);
            }
        }
Beispiel #10
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (txtNubeBranch.Text == "")
                {
                    MessageBox.Show("Enter NubeBranch...", "Information");
                }

                else
                {
                    if (MessageBox.Show("Do you wanrt to save this record?", "SAVE CONFIRMATION", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        if (ID != 0)
                        {
                            MASTERNUBEBRANCH ms = db.MASTERNUBEBRANCHes.Where(x => x.NUBE_BRANCH_CODE == ID).FirstOrDefault();
                            var OldData         = new JSonHelper().ConvertObjectToJSon(ms);

                            ms.NUBE_BRANCH_NAME     = txtNubeBranch.Text;
                            ms.NUBE_BRANCH_USERCODE = txtNUBECODE.Text;
                            db.SaveChanges();

                            var NewData = new JSonHelper().ConvertObjectToJSon(ms);
                            AppLib.EventHistory(this.Tag.ToString(), 1, OldData, NewData, "MASTERNUBEBRANCH");

                            MessageBox.Show("Saved Successfully!", "Saved", MessageBoxButton.OK, MessageBoxImage.Information);
                            FormClear();
                        }
                        else
                        {
                            if (db.MASTERNUBEBRANCHes.Where(x => x.NUBE_BRANCH_NAME == txtNubeBranch.Text).Select(x => x.NUBE_BRANCH_NAME).FirstOrDefault() == txtNubeBranch.Text.ToString())
                            {
                                MessageBox.Show("'" + txtNubeBranch.Text + "' already Name exist! Enter new  Name...!", "Information");
                            }
                            else
                            {
                                MASTERNUBEBRANCH ms = new MASTERNUBEBRANCH();
                                ms.NUBE_BRANCH_NAME     = txtNubeBranch.Text;
                                ms.NUBE_BRANCH_USERCODE = txtNUBECODE.Text;
                                db.MASTERNUBEBRANCHes.Add(ms);
                                db.SaveChanges();

                                var NewData = new JSonHelper().ConvertObjectToJSon(ms);
                                AppLib.EventHistory(this.Tag.ToString(), 0, "", NewData, "MASTERNUBEBRANCH");
                                MessageBox.Show("Saved Successfully!", "Saved", MessageBoxButton.OK, MessageBoxImage.Information);
                                FormClear();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Nube.ExceptionLogging.SendErrorToText(ex);
            }
        }
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (txtCountry.Text == "")
                {
                    MessageBox.Show("Enter Country...", "Information");
                    txtCountry.Focus();
                }

                else
                {
                    if (MessageBox.Show("Do you wanrt to save this record?", "SAVE CONFIRMATION", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        if (db.CountrySetups.Where(x => x.CountryName == txtCountry.Text).Select(x => x.CountryName).FirstOrDefault() == txtCountry.Text.ToString())
                        {
                            MessageBox.Show("'" + txtCountry.Text + "' already exist! Enter new  Country...", "Information");
                        }
                        else if (ID != 0)
                        {
                            CountrySetup c       = db.CountrySetups.Where(x => x.ID == ID).FirstOrDefault();
                            var          OldData = new JSonHelper().ConvertObjectToJSon(c);

                            c.CountryName = txtCountry.Text;
                            db.SaveChanges();
                            AppLib.lstCountrySetup = db.CountrySetups.OrderBy(x => x.CountryName).ToList();

                            var NewData = new JSonHelper().ConvertObjectToJSon(c);
                            AppLib.EventHistory(this.Tag.ToString(), 1, OldData, NewData, "CountrySetup");

                            MessageBox.Show("Saved Successfully!", "Saved", MessageBoxButton.OK, MessageBoxImage.Information);
                            FormClear();
                        }
                        else
                        {
                            CountrySetup c = new CountrySetup();
                            c.CountryName = txtCountry.Text;
                            db.CountrySetups.Add(c);
                            db.SaveChanges();
                            AppLib.lstCountrySetup = db.CountrySetups.OrderBy(x => x.CountryName).ToList();

                            var NewData = new JSonHelper().ConvertObjectToJSon(c);

                            AppLib.EventHistory(this.Tag.ToString(), 0, "", NewData, "CountrySetup");
                            MessageBox.Show("Saved Successfully!", "Saved", MessageBoxButton.OK, MessageBoxImage.Information);
                            FormClear();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Nube.ExceptionLogging.SendErrorToText(ex);
            }
        }
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (txtReasonName.Text == "")
                {
                    MessageBox.Show("Enter Reason...", "Information", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtReasonName.Focus();
                }
                else if (chkIsBefitValid.IsChecked == true && string.IsNullOrEmpty(txtMinimumYear.Text))
                {
                    MessageBox.Show("Enter Minimum Year...", "Information", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtMinimumYear.Focus();
                }
                else if (chkIsBefitValid.IsChecked == true && string.IsNullOrEmpty(txtMinimumRefund.Text))
                {
                    MessageBox.Show("Enter Minimum Refund...", "Information", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtMinimumRefund.Focus();
                }
                else if (chkIsBefitValid.IsChecked == true && string.IsNullOrEmpty(txtMAximumRefund.Text))
                {
                    MessageBox.Show("Enter Maximum Refund...", "Information", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtMAximumRefund.Focus();
                }
                else if (chkIsBefitValid.IsChecked == true && string.IsNullOrEmpty(txtAmnt1.Text))
                {
                    MessageBox.Show("Enter Amount1...", "Information", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtAmnt1.Focus();
                }
                else if (chkIsBefitValid.IsChecked == true && string.IsNullOrEmpty(txtAmnt2.Text))
                {
                    MessageBox.Show("Enter Amount2...", "Information", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtAmnt2.Focus();
                }
                else
                {
                    if (MessageBox.Show("Do you want to save this record?", "SAVE CONFIRMATION", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                    {
                        if (ID != 0)
                        {
                            MASTERRESIGNSTATU ms = db.MASTERRESIGNSTATUS.Where(x => x.RESIGNSTATUS_CODE == ID).FirstOrDefault();
                            var OldData          = new JSonHelper().ConvertObjectToJSon(ms);

                            ms.RESIGNSTATUS_NAME = txtReasonName.Text;
                            if (chkIsBefitValid.IsChecked == true)
                            {
                                ms.IsBenefitValid = Convert.ToBoolean(chkIsBefitValid.IsChecked);
                                ms.MinimumYear    = Convert.ToInt32(txtMinimumYear.Text);
                                ms.MinimumRefund  = Convert.ToInt32(txtMinimumRefund.Text);
                                ms.MaximumRefund  = Convert.ToInt32(txtMAximumRefund.Text);
                                ms.AmtPerYear1    = Convert.ToInt32(txtAmnt1.Text);
                                ms.AmtPerYear2    = Convert.ToInt32(txtAmnt2.Text);
                            }

                            db.SaveChanges();

                            var NewData = new JSonHelper().ConvertObjectToJSon(ms);
                            AppLib.EventHistory(this.Tag.ToString(), 1, OldData, NewData, "MASTERRESIGNSTATUS");
                            MessageBox.Show("Saved Successfully!", "SAVED", MessageBoxButton.OK, MessageBoxImage.Information);
                            FormClear();
                        }
                        else
                        {
                            if (db.MASTERRESIGNSTATUS.Where(x => x.RESIGNSTATUS_NAME == txtReasonName.Text).ToString() == txtReasonName.Text.ToString())
                            {
                                MessageBox.Show("'" + txtReasonName.Text + "' Already exist.Enter new relation.", "Information", MessageBoxButton.OK, MessageBoxImage.Error);
                                txtReasonName.Focus();
                            }
                            else
                            {
                                MASTERRESIGNSTATU ms = new MASTERRESIGNSTATU();
                                ms.RESIGNSTATUS_NAME = txtReasonName.Text;
                                if (chkIsBefitValid.IsChecked == true)
                                {
                                    ms.IsBenefitValid = Convert.ToBoolean(chkIsBefitValid.IsChecked);
                                    ms.MinimumYear    = Convert.ToInt32(txtMinimumYear.Text);
                                    ms.MinimumRefund  = Convert.ToInt32(txtMinimumRefund.Text);
                                    ms.MaximumRefund  = Convert.ToInt32(txtMAximumRefund.Text);
                                    ms.AmtPerYear1    = Convert.ToInt32(txtAmnt1.Text);
                                    ms.AmtPerYear2    = Convert.ToInt32(txtAmnt2.Text);
                                }

                                db.MASTERRESIGNSTATUS.Add(ms);
                                db.SaveChanges();

                                var NewData = new JSonHelper().ConvertObjectToJSon(ms);
                                AppLib.EventHistory(this.Tag.ToString(), 0, "", NewData, "MASTERRESIGNSTATUS");
                                MessageBox.Show("Saved Successfully!", "SAVED", MessageBoxButton.OK, MessageBoxImage.Information);
                                FormClear();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Nube.ExceptionLogging.SendErrorToText(ex);
            }
        }
Beispiel #13
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtUserName.Text))
                {
                    MessageBox.Show("User Name is Empty!");
                    txtUserName.Focus();
                    return;
                }
                else if (string.IsNullOrEmpty(txtPassword.Password.ToString()))
                {
                    MessageBox.Show("Password is Empty!");
                    txtPassword.Focus();
                    return;
                }
                else if (string.IsNullOrEmpty(cmbUserType.Text))
                {
                    MessageBox.Show("User Type is Empty!");
                    cmbUserType.Focus();
                    return;
                }
                else
                {
                    if (MessageBox.Show("Do you want to Save '" + txtUserName.Text + "'?", "SAVE", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        if (iID == 0)
                        {
                            UserAccount usc = (from x in db.UserAccounts where x.UserName == txtUserName.Text select x).FirstOrDefault();
                            if (usc == null)
                            {
                                UserAccount us = new UserAccount()
                                {
                                    UserName    = txtUserName.Text,
                                    UserType    = Convert.ToInt32(cmbUserType.SelectedValue),
                                    Password    = txtPassword.Password,
                                    CompanyName = txtCompanyName.Text,
                                    UserCode    = txtUserCode.Text
                                };
                                db.UserAccounts.Add(us);
                                db.SaveChanges();

                                var NewData = new JSonHelper().ConvertObjectToJSon(us);
                                AppLib.EventHistory(this.Tag.ToString(), 0, "", NewData, "UserAccount");
                                MessageBox.Show("User Account Added Sucessfully!");
                                fClear();
                            }
                            else
                            {
                                MessageBox.Show("User Name Already Found!");
                                txtUserName.Focus();
                                return;
                            }
                        }
                        else if (iID == 1)
                        {
                            MessageBox.Show("You Can't Change This! , Contact Administrator!", "User Restricted!", MessageBoxButton.OK, MessageBoxImage.Information);
                        }
                        else
                        {
                            UserAccount usc     = (from x in db.UserAccounts where x.UserId == iID select x).FirstOrDefault();
                            var         OldData = new JSonHelper().ConvertObjectToJSon(usc);

                            usc.UserName    = txtUserName.Text;
                            usc.UserType    = Convert.ToInt32(cmbUserType.SelectedValue);
                            usc.Password    = txtPassword.Password;
                            usc.CompanyName = txtCompanyName.Text;
                            usc.UserCode    = txtUserCode.Text;
                            db.SaveChanges();

                            var NewData = new JSonHelper().ConvertObjectToJSon(usc);
                            AppLib.EventHistory(this.Tag.ToString(), 1, OldData, NewData, "UserAccount");
                            MessageBox.Show("User Account Updated Successfully!");
                            fClear();
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #14
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (txtOrganisationName.Text == "")
                {
                    MessageBox.Show("Enter Organisation ...", "Information", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtOrganisationName.Focus();
                }
                else
                {
                    if (MessageBox.Show("Do you want to save this record?", "SAVE CONFIRMATION", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                    {
                        if (db.MASTERNAMESETUPs.Where(x => x.ORGANISATION_NAME == txtOrganisationName.Text).ToString() == txtOrganisationName.Text.ToString())
                        {
                            MessageBox.Show("'" + txtOrganisationName.Text + "' Already exist.Enter new relation.", "Information", MessageBoxButton.OK, MessageBoxImage.Error);
                            txtOrganisationName.Focus();
                        }
                        else
                        {
                            if (txtOrganisationName.Text != "")
                            {
                                MASTERNAMESETUP ms      = db.MASTERNAMESETUPs.Where(x => x.ORGANISATION_NAME == txtOrganisationName.Text).FirstOrDefault();
                                var             OldData = new JSonHelper().ConvertObjectToJSon(ms);

                                ms.ORGANISATION_NAME = txtOrganisationName.Text;
                                ms.ADDRESS1          = txtAddress1.Text;
                                ms.ADDRESS2          = txtAddress2.Text;
                                ms.ADDRESS3          = txtAddress3.Text;
                                ms.CITY           = txtCity.Text;
                                ms.STATE          = txtState.Text;
                                ms.COUNTRY        = txtCountry.Text;
                                ms.PHONE          = txtPhoneNo.Text;
                                ms.ZIPCODE        = txtZipCode.Text;
                                ms.SERVERNAME     = txtServerName.Text;
                                ms.NEWEXEPATH     = txtExePath.Text;
                                ms.NEWIMAGESPATH  = txtNewImagePath.Text;
                                ms.NEWREPORTSPATH = txtNewReportPath.Text;
                                ms.SERVERNAME     = txtServerName.Text;
                                ms.VERSION        = txtVersion.Text;


                                ms.EnterenceFees = Convert.ToDecimal(txtEntranceFeed.Text);
                                ms.BadgeAmount   = Convert.ToDecimal(txtBadgeAmt.Text);
                                ms.BF            = Convert.ToDecimal(txtBF.Text);
                                ms.BuildingFund  = Convert.ToDecimal(txtBuildingFund.Text);
                                ms.Insurance     = Convert.ToDecimal(txtInsurance.Text);
                                ms.Subscription  = Convert.ToDecimal(txtSubscription.Text);

                                ms.LevyAmount   = Convert.ToDecimal(txtLevyAmount.Text);
                                ms.TDFAmount    = Convert.ToDecimal(txtTDFAmount.Text);
                                ms.RejoinAmount = Convert.ToDecimal(txtRejoinAmount.Text);

                                ms.SenderEmailId  = txtEmailID.Text;
                                ms.SenderPassword = txtPassword.Password;

                                ms.CCEamilId1 = txtCCEmailID1.Text;
                                ms.CCEamilId2 = txtCCEmailID2.Text;

                                ms.PrinterName = txtPrinterName.Text;
                                ms.BackUpPath  = txtPath.Text;

                                db.SaveChanges();

                                var NewData = new JSonHelper().ConvertObjectToJSon(ms);
                                AppLib.EventHistory(this.Tag.ToString(), 1, OldData, NewData, "MASTERNAMESETUP");
                                MessageBox.Show("Saved Successfully!", "SAVED", MessageBoxButton.OK, MessageBoxImage.Information);
                                if (sFormName == "HOME")
                                {
                                    frmHomeMaster frm = new frmHomeMaster();
                                    this.Close();
                                    frm.ShowDialog();
                                }
                                else
                                {
                                    this.Close();
                                }
                            }
                            else
                            {
                                MASTERNAMESETUP ms = new MASTERNAMESETUP();
                                ms.ORGANISATION_NAME = txtOrganisationName.Text;
                                ms.ADDRESS1          = txtAddress1.Text;
                                ms.ADDRESS2          = txtAddress2.Text;
                                ms.ADDRESS3          = txtAddress3.Text;
                                ms.CITY           = txtCity.Text;
                                ms.STATE          = txtState.Text;
                                ms.COUNTRY        = txtCountry.Text;
                                ms.PHONE          = txtPhoneNo.Text;
                                ms.ZIPCODE        = txtZipCode.Text;
                                ms.SERVERNAME     = txtServerName.Text;
                                ms.NEWEXEPATH     = txtExePath.Text;
                                ms.NEWIMAGESPATH  = txtNewImagePath.Text;
                                ms.NEWREPORTSPATH = txtNewReportPath.Text;
                                ms.SERVERNAME     = txtServerName.Text;
                                ms.VERSION        = txtVersion.Text;


                                ms.EnterenceFees = Convert.ToDecimal(txtEntranceFeed.Text);
                                ms.BadgeAmount   = Convert.ToDecimal(txtBadgeAmt.Text);
                                ms.BF            = Convert.ToDecimal(txtBF.Text);
                                ms.BuildingFund  = Convert.ToDecimal(txtBuildingFund.Text);
                                ms.Insurance     = Convert.ToDecimal(txtInsurance.Text);
                                ms.Subscription  = Convert.ToDecimal(txtSubscription.Text);

                                ms.LevyAmount   = Convert.ToDecimal(txtLevyAmount.Text);
                                ms.TDFAmount    = Convert.ToDecimal(txtTDFAmount.Text);
                                ms.RejoinAmount = Convert.ToDecimal(txtRejoinAmount.Text);

                                ms.SenderEmailId  = txtEmailID.Text;
                                ms.SenderPassword = txtPassword.Password;

                                ms.CCEamilId1 = txtCCEmailID1.Text;
                                ms.CCEamilId2 = txtCCEmailID2.Text;

                                ms.PrinterName = txtPrinterName.Text;
                                ms.BackUpPath  = txtPath.Text;

                                db.MASTERNAMESETUPs.Add(ms);
                                db.SaveChanges();

                                var NewData = new JSonHelper().ConvertObjectToJSon(ms);
                                AppLib.EventHistory(this.Tag.ToString(), 0, "", NewData, "MASTERNAMESETUP");
                                MessageBox.Show("Saved Successfully!", "SAVED", MessageBoxButton.OK, MessageBoxImage.Information);
                                if (sFormName == "HOME")
                                {
                                    frmHomeMaster frm = new frmHomeMaster();
                                    this.Close();
                                    frm.ShowDialog();
                                }
                                else
                                {
                                    this.Close();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Nube.ExceptionLogging.SendErrorToText(ex);
            }
        }
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (txtBankName.Text == "")
                {
                    MessageBox.Show("Enter Bank Name!");
                    txtBankName.Focus();
                }
                else if (txtBankUserCode.Text == "")
                {
                    MessageBox.Show("Enter User Code!");
                    txtBankUserCode.Focus();
                }
                //else if (cmbNubeBranch.Text == "")
                //{
                //    MessageBox.Show("Enter Branch Name!");
                //    cmbNubeBranch.Focus();
                //}
                else if (MessageBox.Show("Do You want to save this Record?", "Save Confirmation", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    if (ID != 0)
                    {
                        decimal    id      = (decimal)ID;
                        MASTERBANK mb      = db.MASTERBANKs.Where(x => x.BANK_CODE == id).FirstOrDefault();
                        var        OldData = new JSonHelper().ConvertObjectToJSon(mb);

                        mb.BANK_NAME     = txtBankName.Text;
                        mb.BANK_USERCODE = txtBankUserCode.Text;
                        //mb.NUBE_BRANCH = 2;

                        db.SaveChanges();
                        AppLib.lstMASTERBANK = db.MASTERBANKs.OrderBy(x => x.BANK_NAME).ToList();
                        var NewData = new JSonHelper().ConvertObjectToJSon(mb);

                        AppLib.EventHistory(this.Tag.ToString(), 1, OldData, NewData, "MASTERBANK");
                        MessageBox.Show("Saved Successfully");
                        ClearForm();
                    }
                    else
                    {
                        MASTERBANK mb = new MASTERBANK();
                        mb.BANK_NAME     = txtBankName.Text;
                        mb.BANK_USERCODE = txtBankUserCode.Text;
                        //mb.NUBE_BRANCH = 2;
                        db.MASTERBANKs.Add(mb);
                        db.SaveChanges();
                        AppLib.lstMASTERBANK = db.MASTERBANKs.OrderBy(x => x.BANK_NAME).ToList();

                        var NewData = new JSonHelper().ConvertObjectToJSon(mb);
                        AppLib.EventHistory(this.Tag.ToString(), 0, "", NewData, "MASTERBANK");
                        MessageBox.Show("Saved Successfully");
                        ClearForm();
                    }
                }
            }
            catch (Exception ex)
            {
                Nube.ExceptionLogging.SendErrorToText(ex);
            }
        }
Beispiel #16
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                bValidation = false;
                BeforeUpdate();
                if (bValidation == false)
                {
                    MASTERMEMBER mmMst = (from mas in db.MASTERMEMBERs where mas.MEMBER_CODE == dMember_Code select mas).FirstOrDefault();

                    if (bUpdate == false)
                    {
                        DataView dv = new DataView(dtArrearPost);
                        dv.RowFilter = "AMOUNT>0";
                        int iTotalDuePay = dv.Count;

                        ArrearPostMaster arrearMaster = new ArrearPostMaster
                        {
                            MemberCode              = dMember_Code,
                            EntryDate               = DateTime.Now,
                            BeforeLastPaymentDate   = mmMst.LASTPAYMENT_DATE,
                            BeforeTotalBF           = mmMst.ACCBF,
                            BeforeTotalSubscription = mmMst.ACCSUBSCRIPTION,
                            BeforeTotalMonthsPaid   = Convert.ToInt32(mmMst.TOTALMONTHSPAID),
                            TotalDuePay             = iTotalDuePay,
                            UpdatedStatus           = "Not Updated"
                        };
                        db.ArrearPostMasters.Add(arrearMaster);
                        db.SaveChanges();

                        var NewData = new JSonHelper().ConvertObjectToJSon(arrearMaster);
                        AppLib.EventHistory(this.Tag.ToString(), 0, "", NewData, "ArrearPostMaster");

                        DataTable dtTemp = new DataTable();
                        dtTemp = ((DataView)dgArrearPost.ItemsSource).ToTable();
                        var iMasterId = Convert.ToInt32(db.ArrearPostMasters.Max(x => x.ID));

                        List <ArrearPostDetail> lstArrearDtl = new List <ArrearPostDetail>();

                        foreach (DataRow row in dtTemp.Rows)
                        {
                            if (Convert.ToDecimal(row["AMOUNT"]) != 0)
                            {
                                ArrearPostDetail arrearDtl = new ArrearPostDetail
                                {
                                    MasterId           = iMasterId,
                                    Year               = Convert.ToInt32(row["YEAR"]),
                                    Month              = Convert.ToDateTime("1/" + row["MONTH"] + row["YEAR"]).Month,
                                    TotalAmount        = Convert.ToDecimal(row["AMOUNT"]),
                                    AmounBF            = Convert.ToDecimal(row["BF"]),
                                    AmountInsurance    = Convert.ToDecimal(row["INSURANCE"]),
                                    AmountSubscription = Convert.ToDecimal(row["SUBSCRIPTION"]),
                                    UpdatedStatus      = "Not Updated",
                                    MemberCode         = Convert.ToInt32(dMember_Code)
                                };
                                lstArrearDtl.Add(arrearDtl);
                            }
                        }

                        if (lstArrearDtl.Count > 0)
                        {
                            db.ArrearPostDetails.AddRange(lstArrearDtl);
                            db.SaveChanges();

                            var NewData1 = new JSonHelper().ConvertObjectToJSon(lstArrearDtl);
                            AppLib.EventHistory(this.Tag.ToString(), 0, "", NewData1, "ArrearPostDetail");
                        }

                        MessageBox.Show("Details are Saved Sucessfully");
                        fClear();
                    }
                    else
                    {
                        ArrearPostMaster mst = (from mas in db.ArrearPostMasters where mas.ID == iArrearMst_ID select mas).FirstOrDefault();

                        var      OldData = new JSonHelper().ConvertObjectToJSon(mst);
                        DataView dv      = new DataView(dtArrearPost);
                        dv.RowFilter = "AMOUNT>0";
                        int iTotalDuePay = dv.Count;

                        if (mst != null)
                        {
                            mst.UpdatedEntryDate = DateTime.Now;
                            mst.IsEdited         = true;
                            mst.TotalDuePay      = iTotalDuePay;
                        }
                        db.SaveChanges();

                        var NewData = new JSonHelper().ConvertObjectToJSon(mst);
                        AppLib.EventHistory(this.Tag.ToString(), 1, OldData, NewData, "ArrearPostMaster");

                        ArrearPostDetail dtl = (from mas in db.ArrearPostDetails where mas.MasterId == iArrearMst_ID select mas).FirstOrDefault();
                        var OldData1         = new JSonHelper().ConvertObjectToJSon(dtl);
                        if (dtl != null)
                        {
                            db.ArrearPostDetails.RemoveRange(db.ArrearPostDetails.Where(x => x.MasterId == iArrearMst_ID));
                            db.SaveChanges();
                        }

                        DataTable dtTemp = new DataTable();
                        dtTemp = ((DataView)dgArrearPost.ItemsSource).ToTable();

                        List <ArrearPostDetail> lstArrearDtl = new List <ArrearPostDetail>();

                        foreach (DataRow row in dtTemp.Rows)
                        {
                            if (Convert.ToDecimal(row["AMOUNT"]) != 0)
                            {
                                ArrearPostDetail arrearDtl = new ArrearPostDetail
                                {
                                    MasterId           = iArrearMst_ID,
                                    Year               = Convert.ToInt32(row["YEAR"]),
                                    Month              = Convert.ToDateTime("1/" + row["MONTH"] + row["YEAR"]).Month,
                                    TotalAmount        = Convert.ToDecimal(row["AMOUNT"]),
                                    AmounBF            = Convert.ToDecimal(row["BF"]),
                                    AmountInsurance    = Convert.ToDecimal(row["INSURANCE"]),
                                    AmountSubscription = Convert.ToDecimal(row["SUBSCRIPTION"]),
                                    UpdatedStatus      = "Not Updated",
                                    MemberCode         = Convert.ToInt32(dMember_Code)
                                };
                                lstArrearDtl.Add(arrearDtl);
                            }
                        }

                        if (lstArrearDtl.Count > 0)
                        {
                            db.ArrearPostDetails.AddRange(lstArrearDtl);
                            db.SaveChanges();

                            var NewData1 = new JSonHelper().ConvertObjectToJSon(lstArrearDtl);
                            AppLib.EventHistory(this.Tag.ToString(), 1, OldData1, NewData1, "ArrearPostDetail");
                        }

                        MessageBox.Show("Details are Updated Sucessfully");
                        fClear();
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionLogging.SendErrorToText(ex);
            }
        }
Beispiel #17
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (cmbBankName.Text == "")
                {
                    MessageBox.Show("Enter Bank..", "Information");
                    txtBranchName.Focus();
                }

                else if (txtBranchCode.Text == "")
                {
                    MessageBox.Show("Enter Branchcode..", "Information");
                    txtBranchCode.Focus();
                }
                else if (txtBranchName.Text == "")
                {
                    MessageBox.Show("Enter Branchname..", "Information");
                }
                else
                {
                    if (MessageBox.Show("Do you want to save this record?", "SAVE", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        if (ID != 0)
                        {
                            decimal          id = (decimal)ID;
                            var              s  = cmbBankName.Text.ToString();
                            MASTERBANKBRANCH mb = db.MASTERBANKBRANCHes.Where(x => x.BANKBRANCH_CODE == id).FirstOrDefault();

                            //var OldData = new JSonHelper().ConvertObjectToJSon(mb);

                            mb.BANK_CODE             = Convert.ToDecimal(cmbBankName.SelectedValue);
                            mb.BANKBRANCH_NAME       = txtBranchName.Text;
                            mb.BANKBRANCH_USERCODE   = txtBranchCode.Text;
                            mb.BANKBRANCH_ADDRESS1   = txtAddress1.Text;
                            mb.BANKBRANCH_ADDRESS2   = txtAddress2.Text;
                            mb.BANKBRANCH_ADDRESS3   = txtAddress3.Text;
                            mb.BANKBRANCH_CITY_CODE  = Convert.ToDecimal(cmbCity.SelectedValue);
                            mb.BANKBRANCH_COUNTRY    = (cmbCountry.Text.ToString() == null ? "" : cmbCountry.Text.ToString());
                            mb.BANKBRANCH_EMAIL      = txtEmail.Text;
                            mb.BANKBRANCH_PHONE1     = txtMobile.Text;
                            mb.BANKBRANCH_PHONE2     = txtPhone.Text;
                            mb.BANKBRANCH_STATE_CODE = Convert.ToDecimal(cmbState.SelectedValue);
                            mb.BANKBRANCH_ZIPCODE    = txtPostalCode.Text;
                            mb.NUBE_BRANCH_CODE      = Convert.ToDecimal(cmbNUBEBranch.SelectedValue);
                            mb.HEAD_QUARTERS         = Convert.ToDecimal(ckbHeadOffice.IsChecked);

                            db.SaveChanges();
                            AppLib.lstMASTERBANKBRANCH = db.MASTERBANKBRANCHes.OrderBy(x => x.BANKBRANCH_NAME).ToList();

                            //var NewData = new JSonHelper().ConvertObjectToJSon(mb);
                            //AppLib.EventHistory(this.Tag.ToString(), 1, OldData, NewData, "MASTERBANKBRANCH");

                            MessageBox.Show("Saved Successfully", "Saved");
                            ClearForm();
                        }
                        else
                        {
                            MASTERBANKBRANCH mb = new MASTERBANKBRANCH();
                            mb.BANK_CODE             = Convert.ToDecimal(cmbBankName.SelectedValue);
                            mb.BANKBRANCH_NAME       = txtBranchName.Text;
                            mb.BANKBRANCH_USERCODE   = txtBranchCode.Text;
                            mb.BANKBRANCH_ADDRESS1   = txtAddress1.Text;
                            mb.BANKBRANCH_ADDRESS2   = txtAddress2.Text;
                            mb.BANKBRANCH_ADDRESS3   = txtAddress3.Text;
                            mb.BANKBRANCH_CITY_CODE  = Convert.ToDecimal(cmbCity.SelectedValue);
                            mb.BANKBRANCH_COUNTRY    = (cmbCountry.Text.ToString() == null ? "" : cmbCountry.Text.ToString());
                            mb.BANKBRANCH_EMAIL      = txtEmail.Text;
                            mb.BANKBRANCH_PHONE1     = txtMobile.Text;
                            mb.BANKBRANCH_PHONE2     = txtPhone.Text;
                            mb.BANKBRANCH_STATE_CODE = Convert.ToDecimal(cmbState.SelectedValue);
                            mb.BANKBRANCH_ZIPCODE    = txtPostalCode.Text;
                            mb.NUBE_BRANCH_CODE      = Convert.ToDecimal(cmbNUBEBranch.SelectedValue);
                            mb.HEAD_QUARTERS         = Convert.ToDecimal(ckbHeadOffice.IsChecked);

                            db.MASTERBANKBRANCHes.Add(mb);
                            db.SaveChanges();
                            AppLib.lstMASTERBANKBRANCH = db.MASTERBANKBRANCHes.OrderBy(x => x.BANKBRANCH_NAME).ToList();

                            var NewData = new JSonHelper().ConvertObjectToJSon(mb);
                            AppLib.EventHistory(this.Tag.ToString(), 0, "", NewData, "MASTERBANKBRANCH");

                            MessageBox.Show("Saved Successfully!", "Saved");
                            ClearForm();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Nube.ExceptionLogging.SendErrorToText(ex);
            }
        }