Esempio n. 1
0
 /// <summary>
 /// Function to get Voucher Type.
 /// </summary>
 /// <returns></returns>
 public List <voucherTypesInfo> GetVoucherType()
 {
     try
     {
         odbcCon.Open();
         OdbcCommand    odbcCom    = new OdbcCommand("SELECT `$Name`,`$Parent`,`$NumberingMethod`,`$Narration`,`$VchPrintDecl`, `$ActiveTo` FROM VoucherType", odbcCon);
         OdbcDataReader odbcReader = odbcCom.ExecuteReader();
         Clear();
         voucherTypesInfo vouchertypeinfo;
         while (odbcReader.Read())
         {
             vouchertypeinfo             = new voucherTypesInfo();
             vouchertypeinfo.name        = (odbcReader["`$Name`"] != DBNull.Value) ? (odbcReader["`$Name`"].ToString()) : string.Empty;
             vouchertypeinfo.active      = (odbcReader["`$ActiveTo`"] != DBNull.Value) ? (Convert.ToDateTime(odbcReader["`$ActiveTo`"]) > DateTime.Today).ToString() : "true";
             vouchertypeinfo.declaration = (odbcReader["`$VchPrintDecl`"] != DBNull.Value) ? CheckName(odbcReader["`$VchPrintDecl`"].ToString()) : string.Empty;
             vouchertypeinfo.methodOfVoucherNumbering = (odbcReader["`$NumberingMethod`"] != DBNull.Value) ? ((odbcReader["`$NumberingMethod`"].ToString() == "None") ? "Automatic" : odbcReader["`$NumberingMethod`"].ToString()) : string.Empty;
             vouchertypeinfo.narration            = (odbcReader["`$Narration`"] != DBNull.Value) ? CheckName(odbcReader["`$Narration`"].ToString()) : string.Empty;
             vouchertypeinfo.typeOfVoucher        = (odbcReader["`$Parent`"] != DBNull.Value) ? CheckName(odbcReader["`$Parent`"].ToString()) : string.Empty;
             vouchertypeinfo.dotMatrixPrintFormat = vouchertypeinfo.typeOfVoucher;
             lstvouchertypinfo.Add(vouchertypeinfo);
         }
         odbcCon.Close();
         odbcReader.Close();
     }
     catch (Exception ex)
     {
         System.Windows.Application.Current.Dispatcher.Invoke((Action)(() => new wdoMessageBox(ex.Message).ShowDialog()));
     }
     return(lstvouchertypinfo);
 }
Esempio n. 2
0
 public List <voucherTypesInfo> GetVoucherType()
 {
     try
     {
         oledbcon.Open();
         List <string> ff = new List <string>();
         ff.Add("Name");
         ff.Add("Type of Voucher");
         ff.Add("Method Of Voucher Numbering");
         ff.Add("Dot Matrix Print Format");
         Clear();
         voucherTypesInfo vouchertypeinfo;
         string           Exceptions = null;
         if (CheckColumnsMandatory(ff))
         {
             OleDbCommand    oledbcmd    = new OleDbCommand("select * from [Sheet1$]", oledbcon);
             OleDbDataReader oledbReader = oledbcmd.ExecuteReader();
             Clear();
             while (oledbReader.Read())
             {
                 try
                 {
                     vouchertypeinfo      = new voucherTypesInfo();
                     vouchertypeinfo.name = (oledbReader["Name"] != DBNull.Value) ? (oledbReader["Name"].ToString()) : string.Empty;
                     //vouchertypeinfo.dotMatrixPrintFormat = vouchertypeinfo.name;
                     vouchertypeinfo.dotMatrixPrintFormat = (oledbReader["Dot Matrix Print Format"] != DBNull.Value) ? (oledbReader["Dot Matrix Print Format"].ToString()) : string.Empty;
                     //vouchertypeinfo.active = (oledbReader["Active"] != DBNull.Value) ? (Convert.ToDateTime(oledbReader["Active"]) > DateTime.Today) : true;
                     vouchertypeinfo.active      = (oledbReader["Active"] != DBNull.Value) ? ((oledbReader["Active"]).ToString() == "True").ToString() : "false";
                     vouchertypeinfo.declaration = (oledbReader["Declaration"] != DBNull.Value) ? (oledbReader["Declaration"].ToString()) : string.Empty;
                     vouchertypeinfo.methodOfVoucherNumbering = (oledbReader["Method Of Voucher Numbering"] != DBNull.Value) ? ((oledbReader["Method Of Voucher Numbering"].ToString() == "None") ? "Automatic" : oledbReader["Method Of Voucher Numbering"].ToString()) : string.Empty;
                     vouchertypeinfo.narration     = (oledbReader["Narration"] != DBNull.Value) ? (oledbReader["Narration"].ToString()) : string.Empty;
                     vouchertypeinfo.typeOfVoucher = (oledbReader["Type of Voucher"] != DBNull.Value) ? (oledbReader["Type of Voucher"].ToString()) : string.Empty;
                     lstvouchertypinfo.Add(vouchertypeinfo);
                 }
                 catch (FormatException Ex)
                 {
                     Exceptions += (Exceptions == null) ? oledbReader["Name"].ToString() + " - " + Ex.Message : "\n" + oledbReader["Name"].ToString() + " - " + Ex.Message;
                 }
             }
             oledbReader.Close();
             if (Exceptions != null)
             {
                 System.Windows.Application.Current.Dispatcher.Invoke((Action)(() => new wdoMessageBox(Exceptions).ShowDialog()));
             }
         }
         else
         {
             System.Windows.Application.Current.Dispatcher.Invoke((Action)(() => new wdoMessageBox("Mandratory field are Miss matching...").ShowDialog()));
         }
     }
     catch (Exception ex)
     {
         System.Windows.Application.Current.Dispatcher.Invoke((Action)(() => new wdoMessageBox(ex.Message).ShowDialog()));
     }
     finally
     {
         if (oledbcon != null && oledbcon.State == ConnectionState.Open)
         {
             oledbcon.Close();
         }
     }
     return(lstvouchertypinfo);
 }
Esempio n. 3
0
        private void DataLoading(DataGridRowEventArgs e)
        {
            switch (dgDatas.ToolTip.ToString())
            {
            case ("Pricing Level"):
                pricelevelinfo = e.Row.Item as pricingLevelInfo;
                if (pricelevelinfo != null)
                {
                    e.Row.Background = mastervalidation.PriceLevelValidation(pricelevelinfo, out toolTip);
                    e.Row.ToolTip    = toolTip;
                }
                else
                {
                    e.Row.Background = Brushes.Wheat;
                    e.Row.ToolTip    = null;
                }
                break;

            case ("Customer"):
                ledgerinfoforcustomer = e.Row.Item as CustomerSupplierInfo;
                if (ledgerinfoforcustomer != null)
                {
                    e.Row.Background = mastervalidation.CustomerValidations(ledgerinfoforcustomer, out toolTip);
                    e.Row.ToolTip    = toolTip;
                }
                else
                {
                    e.Row.Background = Brushes.Wheat;
                    e.Row.ToolTip    = null;
                }
                break;

            case ("Supplier"):
                ledgerinfoforcustomer = e.Row.Item as CustomerSupplierInfo;
                if (ledgerinfoforcustomer != null)
                {
                    e.Row.Background = mastervalidation.SupplierValidations(ledgerinfoforcustomer, out toolTip);
                    e.Row.ToolTip    = toolTip;
                }
                else
                {
                    e.Row.Background = Brushes.Wheat;
                    e.Row.ToolTip    = null;
                }
                break;

            case ("Account Groups"):
                accountgroupinfo = e.Row.Item as accountGroupInfo;
                if (accountgroupinfo != null)
                {
                    e.Row.Background = mastervalidation.AccountGroupValidation(accountgroupinfo, out toolTip);
                    e.Row.ToolTip    = toolTip;
                }
                else
                {
                    e.Row.Background = Brushes.Wheat;
                    e.Row.ToolTip    = null;
                }
                break;

            case ("Account Ledgers"):
                accountledgerinfo = e.Row.Item as LedgerInfo;
                if (accountledgerinfo != null)
                {
                    e.Row.Background = mastervalidation.LedgerValidations(accountledgerinfo, out toolTip);
                    e.Row.ToolTip    = toolTip;
                }
                else
                {
                    e.Row.Background = Brushes.Wheat;
                    e.Row.ToolTip    = null;
                }
                break;

            case ("Product Groups"):
                productgroupinfo = e.Row.Item as productGroupInfo;
                if (productgroupinfo != null)
                {
                    e.Row.Background = mastervalidation.ProductGroupValidation(productgroupinfo, out toolTip);
                    e.Row.ToolTip    = toolTip;
                }
                else
                {
                    e.Row.Background = Brushes.Wheat;
                    e.Row.ToolTip    = null;
                }
                break;

            case ("Units"):
                unitinfo = e.Row.Item as unitsInfo;
                if (unitinfo != null)
                {
                    e.Row.Background = mastervalidation.UnitValidation(unitinfo, out toolTip);
                    e.Row.ToolTip    = toolTip;
                }
                else
                {
                    e.Row.Background = Brushes.Wheat;
                    e.Row.ToolTip    = null;
                }
                break;

            case ("Godowns"):
                godowninfo = e.Row.Item as godownInfo;
                if (godowninfo != null && godowninfo.Godown_Name != null)
                {
                    e.Row.Background = mastervalidation.GodownValidation(godowninfo, out toolTip);
                    e.Row.ToolTip    = toolTip;
                }
                else
                {
                    e.Row.Background = Brushes.Wheat;
                    e.Row.ToolTip    = null;
                }
                break;

            case ("Products"):
                productinfo = e.Row.Item as productInfo;
                if (productinfo != null)
                {
                    e.Row.Background = mastervalidation.ProductValidation(productinfo, out toolTip);
                    e.Row.ToolTip    = toolTip;
                }
                else
                {
                    e.Row.Background = Brushes.Wheat;
                    e.Row.ToolTip    = null;
                }
                break;


            case ("Stock"):
                Stockinfo = e.Row.Item as StockInfo;
                if (Stockinfo != null)
                {
                    e.Row.Background = mastervalidation.StockValidation(Stockinfo, out toolTip);
                    e.Row.ToolTip    = toolTip;
                }
                else
                {
                    e.Row.Background = Brushes.Wheat;
                    e.Row.ToolTip    = null;
                }
                break;


            case ("Batches"):
                batchinfo = e.Row.Item as batchesInfo;
                if (batchinfo != null)
                {
                    e.Row.Background = mastervalidation.BatchValidation(batchinfo, out toolTip);
                    e.Row.ToolTip    = toolTip;
                }
                else
                {
                    e.Row.Background = Brushes.Wheat;
                    e.Row.ToolTip    = null;
                }
                break;

            case ("Currency"):
                currencyinfo = e.Row.Item as currencyInfo;
                if (currencyinfo != null)
                {
                    if (mastervalidation.CurrencyValidation(currencyinfo))
                    {
                        e.Row.Background = Brushes.LightGreen;
                    }
                    else
                    {
                        e.Row.Background = Brushes.LightCoral;
                        e.Row.ToolTip    = "Currency exists";
                    }
                }
                else
                {
                    e.Row.Background = Brushes.Wheat;
                    e.Row.ToolTip    = null;
                }
                break;

            case ("Voucher Type"):
                vouchertype = e.Row.Item as voucherTypesInfo;
                if (vouchertype != null)
                {
                    e.Row.Background = mastervalidation.VoucherTypeValidation(vouchertype, out toolTip);
                    e.Row.ToolTip    = toolTip;
                }
                else
                {
                    e.Row.Background = Brushes.Wheat;
                    e.Row.ToolTip    = null;
                }
                break;

            case ("SalesMan"):
                employeeinfo = e.Row.Item as EmployeeInfo;
                if (employeeinfo != null && employeeinfo.name != null)
                {
                    e.Row.Background = mastervalidation.SalesmanValidation(employeeinfo, out toolTip);
                    e.Row.ToolTip    = toolTip;
                }
                else
                {
                    e.Row.Background = Brushes.Wheat;
                    e.Row.ToolTip    = null;
                }
                break;

            default:
                break;
            }
        }