示例#1
0
 private void frmVoucher_AddNew(object sender, ref bool _status)
 {
     txtVoucherCode.Text = GetNewID();
     dgrdVouchers.Enabled = false;
     GridSelectedRow = dgrdVouchers.SelectedRows[0].Index;
     CrVoucher = new VoucherType();
 }
示例#2
0
        private void dgrdVouchers_SelectionChanged(object sender, EventArgs e)
        {
            if (dgrdVouchers.SelectedRows.Count != 0)
            {

                VOUCHERTYPEID = dgrdVouchers.SelectedRows[0].Cells[0].Value.ToString();
                VoucherType SelectedVoucherType = VouchersList.Find(a => a.VoucherTypeId == VOUCHERTYPEID);
                ShowGUI(SelectedVoucherType);

                CrVoucher = SelectedVoucherType;
            }
        }
示例#3
0
        private void ShowGUI(VoucherType _vouchertype)
        {
            if (_vouchertype.VoucherTypeCurrencyID != 0)
            {
                cbxCurrency.SelectedValue = _vouchertype.VoucherTypeCurrencyID;
            }
            if (!string.IsNullOrEmpty(_vouchertype.CriedtAccountID))
            {
                cbxCreditAccounts.SelectedValue = _vouchertype.CriedtAccountID;
            }
            if (!string.IsNullOrEmpty(_vouchertype.DepitAccountId))
            {
                cbxDepitAccounts.SelectedValue = _vouchertype.DepitAccountId;
            }

            txtVoucherCode.Text = _vouchertype.VoucherTypeId;
            txtArabicName.Text = _vouchertype.VoucherArName;
            txtEnglishName.Text = _vouchertype.VoucherEnName;
            txtEliasAr.Text = _vouchertype.ShortName_Ara;
            txtEliasEn.Text = _vouchertype.ShortName_Eng;

            txtArDtlExtraField1.Text = _vouchertype.DetailExtraField1;
            txtArDtlExtraField2.Text = _vouchertype.DetailExtraField2;
            txtArDtlExtraField3.Text = _vouchertype.DetailExtraField3;
            txtArDtlExtraField4.Text = _vouchertype.DetailExtraField4;
            txtArDtlExtraField5.Text = _vouchertype.DetailExtraField5;

            txtEnExtraField1.Text = _vouchertype.MainExtraField1;
            txtEnExtraField2.Text = _vouchertype.MainExtraField2;
            txtEnExtraField3.Text = _vouchertype.MainExtraField3;
            txtEnExtraField4.Text = _vouchertype.MainExtraField4;
            txtEnExtraField5.Text = _vouchertype.MainExtraField5;

            if (_vouchertype.MainValidationField1 != null)
            {
                cbxValidation1.SelectedValue = _vouchertype.MainValidationField1;
            }
            if (_vouchertype.MainValidationField2 != null)
            {
                cbxValidation2.SelectedValue = _vouchertype.MainValidationField2;
            }
            if (_vouchertype.mainValidationField3 != null)
            {
                cbxValidation3.SelectedValue = _vouchertype.mainValidationField3;
            }
            if (_vouchertype.MainValidationField4 != null)
            {
                cbxValidation4.SelectedValue = _vouchertype.MainValidationField4;
            }
            if (_vouchertype.MainValidationField5 != null)
            {
                cbxValidation5.SelectedValue = _vouchertype.MainValidationField5;
            }

            if (_vouchertype.DtlValidationField1 != null)
            {
                cbxDtlValidation1.SelectedValue = _vouchertype.DtlValidationField1;
            }
            if (_vouchertype.DtlValidationField2 != null)
            {
                cbxDtlValidation2.SelectedValue = _vouchertype.DtlValidationField2;
            }
            if (_vouchertype.DtlValidationField3 != null)
            {
                cbxDtlValidation3.SelectedValue = _vouchertype.DtlValidationField3;
            }
            if (_vouchertype.DtlValidationField4 != null)
            {
                cbxDtlValidation4.SelectedValue = _vouchertype.DtlValidationField4;
            }
            if (_vouchertype.DtlValidationField5 != null)
            {
                cbxDtlValidation5.SelectedValue = _vouchertype.DtlValidationField5;
            }
        }
示例#4
0
        private void GetDataFromGUI()
        {
            CrVoucher = new VoucherType();
            if (cbxCurrency.SelectedIndex != -1)
            {
                CrVoucher.VoucherTypeCurrencyID = Convert.ToInt32(cbxCurrency.SelectedValue);
            }
            if (!string.IsNullOrEmpty(txtVoucherCode.Text))
            {
                CrVoucher.VoucherTypeId = txtVoucherCode.Text;
            }
            if (cbxCreditAccounts.SelectedIndex != -1)
            {
                CrVoucher.CriedtAccountID = cbxCreditAccounts.SelectedValue.ToString();
            }
            if (cbxDepitAccounts.SelectedIndex != -1)
            {
                CrVoucher.DepitAccountId = cbxDepitAccounts.SelectedValue.ToString();
            }
            CrVoucher.VoucherArName = txtArabicName.Text;
            CrVoucher.VoucherEnName = txtEnglishName.Text;
            CrVoucher.ShortName_Ara = txtEliasAr.Text;
            CrVoucher.ShortName_Eng = txtEliasEn.Text;

            CrVoucher.DetailExtraField1 = txtArDtlExtraField1.Text;
            CrVoucher.DetailExtraField2 = txtArDtlExtraField2.Text;
            CrVoucher.DetailExtraField3 = txtArDtlExtraField3.Text;
            CrVoucher.DetailExtraField4 = txtArDtlExtraField4.Text;
            CrVoucher.DetailExtraField5 = txtArDtlExtraField5.Text;

            CrVoucher.MainExtraField1 = txtEnExtraField1.Text;
            CrVoucher.MainExtraField2 = txtEnExtraField2.Text;
            CrVoucher.MainExtraField3 = txtEnExtraField3.Text;
            CrVoucher.MainExtraField4 = txtEnExtraField4.Text;
            CrVoucher.MainExtraField5 = txtEnExtraField5.Text;

            if (cbxValidation1.SelectedIndex != -1)
            {
                CrVoucher.MainValidationField1 = Convert.ToInt32(cbxValidation1.SelectedValue);
            }
            if (cbxValidation2.SelectedIndex != -1)
            {
                CrVoucher.MainValidationField2 = Convert.ToInt32(cbxValidation2.SelectedValue);
            }
            if (cbxValidation3.SelectedIndex != -1)
            {
                CrVoucher.mainValidationField3 = Convert.ToInt32(cbxValidation3.SelectedValue);
            }
            if (cbxValidation4.SelectedIndex != -1)
            {
                CrVoucher.MainValidationField4 = Convert.ToInt32(cbxValidation4.SelectedValue);
            }
            if (cbxValidation5.SelectedIndex != -1)
            {
                CrVoucher.MainValidationField5 = Convert.ToInt32(cbxValidation5.SelectedValue);
            }

            if (cbxDtlValidation1.SelectedIndex != -1)
            {
                CrVoucher.DtlValidationField1 = Convert.ToInt32(cbxDtlValidation1.SelectedValue);
            }
            if (cbxDtlValidation2.SelectedIndex != -1)
            {
                CrVoucher.DtlValidationField2 = Convert.ToInt32(cbxDtlValidation2.SelectedValue);
            }
            if (cbxDtlValidation3.SelectedIndex != -1)
            {
                CrVoucher.DtlValidationField3 = Convert.ToInt32(cbxDtlValidation3.SelectedValue);
            }
            if (cbxDtlValidation4.SelectedIndex != -1)
            {
                CrVoucher.DtlValidationField4 = Convert.ToInt32(cbxDtlValidation4.SelectedValue);
            }
            if (cbxDtlValidation5.SelectedIndex != -1)
            {
                CrVoucher.DtlValidationField5 = Convert.ToInt32(cbxDtlValidation5.SelectedValue);
            }
        }
示例#5
0
 private void frmVoucher_Delete(object sender, ref bool _status)
 {
     VoucherType VoucherType = new VoucherType();
     if (CrVoucher == null)
     {
         _status = false;
         return;
     }
     DataDeleteResult result = VoucherType.Delete(VOUCHERTYPEID);
     _status = result.DeleteStatus;
     if (result.DeleteStatus == false)
     {
         MessageBox.Show(result.ErrorMessage);
     }
     else
     {
         CrVoucher = null;
         VouchersList = VoucherType.GetAllVouchers();
         LoadDataGrid(VouchersList);
     }
 }
示例#6
0
        private void frmVoucher_Save(object sender, ref bool _status)
        {
            VoucherType vu = new VoucherType();
            GetDataFromGUI();

            DataSaveResult saveResult = vu.Save(CrVoucher);
            if (saveResult.SaveStatus == false)
            {
                _status = false;
                dgrdVouchers.Rows[GridSelectedRow].Selected = true;
                dgrdVouchers_SelectionChanged(dgrdVouchers, new EventArgs());

            }
            else
            {
                VouchersList = VoucherType.GetAllVouchers();
                LoadDataGrid(VouchersList);
                dgrdVouchers.Rows[VouchersList.Count-1].Selected = true;
                dgrdVouchers_SelectionChanged(dgrdVouchers, new EventArgs());
            }
            dgrdVouchers.Enabled = true;
        }
示例#7
0
        private Acc_VouchersType BuildDBRecord(Acc_VouchersType _AccVouchersType, VoucherType _VoucherType)
        {
            _AccVouchersType.VoucherTypeId = _VoucherType.VoucherTypeId;
            _AccVouchersType.VoucherNmae_Eng = _VoucherType.VoucherEnName;
            _AccVouchersType.VoucherName_Ara = _VoucherType.VoucherArName;
            _AccVouchersType.ShortName_Ara = _VoucherType.ShortName_Ara;
            _AccVouchersType.ShortName_Eng = _VoucherType.ShortName_Eng;

            _AccVouchersType.CreditAccountid = _VoucherType.CriedtAccountID;
            _AccVouchersType.DepitAccountId = _VoucherType.DepitAccountId;
            _AccVouchersType.VoucherCurrancyid = _VoucherType.VoucherTypeCurrencyID;

            _AccVouchersType.MainExtraField1 = _VoucherType.MainExtraField1;
            _AccVouchersType.MainExtraField2 = _VoucherType.MainExtraField2;
            _AccVouchersType.MainExtraField3 = _VoucherType.MainExtraField3;
            _AccVouchersType.MainExtraField4 = _VoucherType.MainExtraField4;
            _AccVouchersType.MainExtraField5 = _VoucherType.MainExtraField5;

            _AccVouchersType.DetailExtraField1 = _VoucherType.DetailExtraField1;
            _AccVouchersType.DetailExtraField2 = _VoucherType.DetailExtraField2;
            _AccVouchersType.DetailExtraField3 = _VoucherType.DetailExtraField3;
            _AccVouchersType.DetailExtraField4 = _VoucherType.DetailExtraField4;
            _AccVouchersType.DetailExtraField5 = _VoucherType.DetailExtraField5;

            _AccVouchersType.MainValidationField1 = _VoucherType.MainValidationField1;
            _AccVouchersType.MainValidationField2 = _VoucherType.MainValidationField2;
            _AccVouchersType.mainValidationField3 = _VoucherType.mainValidationField3;
            _AccVouchersType.MainValidationField4 = _VoucherType.MainValidationField4;
            _AccVouchersType.MainValidationField5 = _VoucherType.MainValidationField5;
            return _AccVouchersType;
        }
示例#8
0
        public DataSaveResult Save(VoucherType _VoucherType)
        {
            try
            {
                Acc_VouchersType AccVouchersType;
                NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString);

                AccVouchersType = newAppsCnn.Acc_VouchersType.Where(a => a.VoucherTypeId == _VoucherType.VoucherTypeId).FirstOrDefault();
                if (AccVouchersType != null)
                {
                    BuildDBRecord(AccVouchersType, _VoucherType);
                }

                else
                {

                    AccVouchersType = new Acc_VouchersType();
                    AccVouchersType = BuildDBRecord(AccVouchersType, _VoucherType);
                    newAppsCnn.Acc_VouchersType.Add(AccVouchersType);
                }

                newAppsCnn.SaveChanges();
                //   Audit.AddDataAudit(Audit.AuditActionTypes.AddNew, "Acc_VouchersType", this);

                return new DataSaveResult() { SaveStatus = true };
            }
            catch (Exception ex)
            {
                return new DataSaveResult() { SaveStatus = false };
            }
        }
示例#9
0
        public static List<VoucherType> GetAllVouchers()
        {
            List<VoucherType> VoucherTypeList = new List<VoucherType>();
            NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString);
            var VouchrsType = from type in newAppsCnn.Acc_VouchersType select type;
            foreach (var voucher in VouchrsType)
            {
                VoucherType VoucherType = new VoucherType();
                VoucherType.VoucherTypeId = voucher.VoucherTypeId;
                VoucherType.VoucherEnName = voucher.VoucherNmae_Eng;
                VoucherType.VoucherArName = voucher.VoucherName_Ara;
                VoucherType.ShortName_Ara = voucher.ShortName_Ara;
                VoucherType.ShortName_Eng = voucher.ShortName_Eng;

                VoucherType.CriedtAccountID = voucher.CreditAccountid;
                VoucherType.DepitAccountId = voucher.DepitAccountId;
                VoucherType.VoucherTypeCurrencyID = Convert.ToInt32(voucher.VoucherCurrancyid);

                VoucherType.MainExtraField1 = voucher.MainExtraField1;
                VoucherType.MainExtraField2 = voucher.MainExtraField2;
                VoucherType.MainExtraField3 = voucher.MainExtraField3;
                VoucherType.MainExtraField4 = voucher.MainExtraField4;
                VoucherType.MainExtraField5 = voucher.MainExtraField5;

                VoucherType.DetailExtraField1 = voucher.DetailExtraField1;
                VoucherType.DetailExtraField2 = voucher.DetailExtraField2;
                VoucherType.DetailExtraField3 = voucher.DetailExtraField3;
                VoucherType.DetailExtraField4 = voucher.DetailExtraField4;
                VoucherType.DetailExtraField5 = voucher.DetailExtraField5;

                VoucherType.MainValidationField1 = voucher.MainValidationField1;
                VoucherType.MainValidationField2 = voucher.MainValidationField2;
                VoucherType.mainValidationField3 = voucher.mainValidationField3;
                VoucherType.MainValidationField4 = voucher.MainValidationField4;
                VoucherType.MainValidationField5 = voucher.MainValidationField5;

                VoucherTypeList.Add(VoucherType);
            }
            return VoucherTypeList;
        }
示例#10
0
 public static List<VoucherType> GetAllValidations()
 {
     List<VoucherType> VoucherValidationList = new List<VoucherType>();
     NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString);
     var VouchrsValidation = from val in newAppsCnn.Acc_VoucherValidation select val;
     foreach (var validation in VouchrsValidation)
     {
         VoucherType Vouchervalidation = new VoucherType();
         Vouchervalidation.VaidationID = validation.ValidationId;
         Vouchervalidation.ValidationArName = validation.ValidationName_Ara;
         Vouchervalidation.ValidationEnName = validation.ValidationName_Eng;
         VoucherValidationList.Add(Vouchervalidation);
     }
     return VoucherValidationList;
 }
示例#11
0
 public static List<VoucherType> GetAllCurrency()
 {
     List<VoucherType> CurrencyList = new List<VoucherType>();
     NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString);
     var Currencys = from val in newAppsCnn.Acc_Currancy select val;
     foreach (var Currency in Currencys)
     {
         VoucherType CurrencyClass = new VoucherType();
         CurrencyClass.CurrencyID = Currency.CurrancyId;
         CurrencyClass.CurrencyArName = Currency.CurrancyName_Ara;
         CurrencyClass.CurrencyEnName = Currency.CurrancyName_Eng;
         CurrencyList.Add(CurrencyClass);
     }
     return CurrencyList;
 }