コード例 #1
0
        private void Set_AppFlyout_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                Log.Info(" Before: To get from setting ,in Set_App");
                Inventory.Model.Setting set = DatabaseAndQueries.Queries.GetDataByCondition <Inventory.Model.Setting>(x => x.Id == 1);
                Log.Info(" After: To get from setting ,in Set_App");
                _s = set;
                if (set != null)
                {
                    DataContext = set;
                    string[] add = set.Address.Split('$');
                    try
                    {
                        addressline1.Text = add[0];
                    }
                    catch (Exception)
                    {
                    }
                    try
                    {
                        addressline2.Text = add[1];
                    }
                    catch (Exception)
                    {
                    }
                    try
                    {
                        addressline3.Text = add[2];
                    }
                    catch (Exception)
                    {
                    }
                    try
                    {
                        addressline4.Text = add[3];
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    Log.Info("setting record not available: ,in Set_App");
                }
            }

            catch (Exception ex)
            {
                Log.Error("Settings is Empty ,in Set_App");
            }
        }
コード例 #2
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            Log.Info("Before : To generate bill in UserControl_Loaded SearchCustomer");
            DataSet   Ds = new DataSet();
            DataTable dt = new DataTable();

            dt.Columns.Add("Product");
            dt.Columns.Add("Qty");
            dt.Columns.Add("Price");
            dt.Columns.Add("TotalAmount");
            dt.Columns.Add("Advance");
            dt.Columns.Add("SaleDate");
            dt.Columns.Add("Type");
            Log.Info("Before :To get data from salelist using foreach UserControl_Loaded SearchCustomer");
            foreach (Sale item in productlst)
            {
                DataRow _r = dt.NewRow();
                _r["Product"]     = item.Product.Pname;
                _r["Qty"]         = item.Quantity;
                _r["Price"]       = item.Price;
                _r["TotalAmount"] = item.TotalAmount;
                _r["Advance"]     = item.Advance;
                _r["SaleDate"]    = item.SaleDate.ToString("dd-MM-yyyy");
                if (item.Type == true)
                {
                    _r["Type"] = "Sale";
                }
                else
                {
                    _r["Type"] = "Purchase";
                }
                dt.Rows.Add(_r);
            }
            Ds.Tables.Add(dt);
            Log.Info("After :To get data from salelist using foreach UserControl_Loaded SearchCustomer");
            string Apppath = System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);

            if (Apppath.IndexOf("\\bin\\Debug") != -1)
            {
                Apppath = Apppath.Remove(Apppath.IndexOf("\\bin\\Debug"));
            }
            Log.Info("Before : To get setting record from db in SearchCustomer");
            Inventory.Model.Setting _Setting = DatabaseAndQueries.Queries.GetDataByCondition <Inventory.Model.Setting>
                                                   (x => x.Id == 1);
            string[] address = _Setting.Address.Split('$');
            Log.Info("After : To get setting record from db in SearchCustomer");
            /*Report Parameters*/
            /*image parametere*/
            //    ReportParameter imageParam = new ReportParameter("imageParam", "file:///" + Apppath + "\\Images\\logo.png");

            ReportParameter companyName  = new ReportParameter("comanyName", _Setting.CompanyName.ToUpper());
            ReportParameter addressLine1 = new ReportParameter("addressLine1", address[0].ToUpper());
            ReportParameter addressLine2 = new ReportParameter("addressLine2", address[1].ToUpper());
            ReportParameter addressLine3 = new ReportParameter("addressLine3", address[2].ToUpper());
            ReportParameter addressLine4 = new ReportParameter("addressLine4", address[3].ToUpper());
            ReportParameter contact      = new ReportParameter("contact", _Setting.ContactNo.ToString());


            ReportParameter DateFromParam = new ReportParameter("DateFromParam", Fdate);
            ReportParameter DateToParam   = new ReportParameter("DateToParam", Ldate);
            ReportParameter CustomerParam = new ReportParameter("CustomerParam", customername);
            ReportParameter AdvanceParam  = new ReportParameter("AdvanceParam", advance);
            ReportParameter BalanceParam  = new ReportParameter("BalanceParam", balance);

            ReportDataSource reportDataSource = new ReportDataSource("ProductDataSet", dt);

            reportViewer.LocalReport.EnableExternalImages   = true;
            reportViewer.LocalReport.ReportEmbeddedResource = "Inventory.Reports.SearchCustomer.rdlc";
            this.reportViewer.LocalReport.SetParameters(new ReportParameter[] {//imageParam,
                companyName, addressLine1, addressLine2, addressLine3, addressLine4, contact, DateFromParam
                , DateToParam, CustomerParam, AdvanceParam, BalanceParam
            });
            this.reportViewer.LocalReport.DataSources.Clear();
            reportViewer.LocalReport.DataSources.Add(reportDataSource);
            reportViewer.RefreshReport();
            Log.Info("After :To generate bill in UserControl_Loaded SearchCustomer");
        }
コード例 #3
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            Log.Info("Before: To get list of all sale record using billno SaleBill report");
            List <Sale> saleslst = Queries.GetAllByCondition <Sale>(x => x.Billing == billno);

            Log.Info("After: To get list of all sale record using billno SaleBill report");
            if (saleslst.Count != 0)
            {
                Log.Info("Before: load datatable of SaleBill report");
                DataSet   Ds = new DataSet();
                DataTable dt = new DataTable();
                dt.Columns.Add("Product");
                dt.Columns.Add("Price");
                dt.Columns.Add("Qty");
                dt.Columns.Add("Discount");
                dt.Columns.Add("Vat");
                dt.Columns.Add("TotalAmount");
                dt.Columns.Add("Advance");
                dt.Columns.Add("Type");
                dt.Columns.Add("RemainingBalance");
                foreach (Sale item in saleslst)
                {
                    DataRow _r = dt.NewRow();
                    _r["Product"]     = item.Product.Pname;
                    _r["Price"]       = item.Price;
                    _r["Qty"]         = item.Quantity;
                    _r["Discount"]    = item.Discount;
                    _r["Vat"]         = item.Vat;
                    _r["TotalAmount"] = item.TotalAmount;
                    _r["Advance"]     = item.Advance;
                    if (item.Type == true)
                    {
                        _r["Type"] = "Sale";
                    }
                    else
                    {
                        _r["Type"] = "Purchase";
                    }
                    _r["RemainingBalance"] = item.RemainingBalance;
                    customer  = item.Customer.Cname;
                    contactno = item.Customer.ContactNo.ToString();
                    add       = item.Customer.Address.ToString();
                    sdate     = item.SaleDate.ToString("dd-MM-yyyy");
                    dt.Rows.Add(_r);
                }
                Ds.Tables.Add(dt);
                Log.Info("Before: getting setting data of SaleBill report");


                string Apppath = System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
                if (Apppath.IndexOf("\\bin\\Debug") != -1)
                {
                    Apppath = Apppath.Remove(Apppath.IndexOf("\\bin\\Debug"));
                }
                Log.Info("Before: To get setting record SaleBill report");
                Inventory.Model.Setting _Setting = DatabaseAndQueries.Queries.GetDataByCondition <Inventory.Model.Setting>
                                                       (x => x.Id == 1);
                Log.Info("After: To get setting record SaleBill report");
                string[] address = _Setting.Address.Split('$');
                /*Report Parameters*/
                /*image parametere*/
                //        ReportParameter imageParam = new ReportParameter("imageParam", "file:///" + Apppath + "\\Images\\logo.png");

                ReportParameter companyName = new ReportParameter("comanyName", _Setting.CompanyName.ToUpper());

                ReportParameter addressLine1 = new ReportParameter("addressLine1", address[0].ToUpper());
                ReportParameter addressLine2 = new ReportParameter("addressLine2", address[1].ToUpper());
                ReportParameter addressLine3 = new ReportParameter("addressLine3", address[2].ToUpper());
                ReportParameter addressLine4 = new ReportParameter("addressLine4", address[3].ToUpper());
                ReportParameter contact      = new ReportParameter("contact", _Setting.ContactNo.ToString());

                ReportParameter cusotmerName    = new ReportParameter("customerName", customer.ToUpper());
                ReportParameter customerAddress = new ReportParameter("customerAddress", add.ToUpper());
                ReportParameter Customercontact = new ReportParameter("Customercontact", contactno.ToString());
                ReportParameter purchasedate    = new ReportParameter("purchasedate", sdate);
                ReportParameter Billno          = new ReportParameter("Billno", billno.ToString());

                ReportDataSource reportDataSource = new ReportDataSource("BillDataset", dt);
                //    reportDataSource.Name = "CustomerReport";            // Name of the DataSet we set in .rdlc

                reportViewer.LocalReport.EnableExternalImages   = true;
                reportViewer.LocalReport.ReportEmbeddedResource = "Inventory.Reports.SearchByCustomer.rdlc";
                this.reportViewer.LocalReport.SetParameters(new ReportParameter[] {// imageParam,
                    companyName, addressLine1, addressLine2, addressLine3, addressLine4, contact, cusotmerName,
                    customerAddress, Customercontact, purchasedate, Billno
                });
                this.reportViewer.LocalReport.DataSources.Clear();
                reportViewer.LocalReport.DataSources.Add(reportDataSource);
                reportViewer.RefreshReport();
            }
            else
            {
                this.Close();
                MessageBox.Show("Record not found");
            }
        }
コード例 #4
0
 public void Sldier_Tick(object sender, EventArgs e)
 {
     if (count < (Slider.Items.Count - 1))
     {
         count++;
         Slider.SelectedIndex = count;
     }
     else
     {
         DatabaseAndQueries.SessionFactory.DatabaseType = DatabaseAndQueries.DBTYPE.SqlLite.ToString();
         DatabaseAndQueries.SessionFactory.FilePath     = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\InventoryDBA\CTE_Data.db";
         DatabaseAndQueries.SessionFactory.AssemblyName = System.Reflection.Assembly.GetExecutingAssembly().ToString();
         Log.Info("Before: call copy database in LodingWindow");
         CopyDataBase();
         Log.Info("After: call copy database,successfully in LodingWindow");
         Log.Info("Before: to get list of setting variable from DB in LoadingWindow");
         IList <Setting> _Sp = Queries.GetAllByCondition <Setting>(x => x.Id == 1);
         Log.Info("after: to get list of setting variable from DB in LoadingWindow");
         var rdiction  = new ResourceDictionary();
         var rdiction1 = new ResourceDictionary();
         if (_Sp == null)
         {
             Setting _setting = new Setting();
             _setting.Accent = "Blue";
             _setting.Theme  = "Basedark";
             Queries.Add <Setting>(_setting);
             rdiction.Source = new Uri(string.Format("pack://application:,,,/MahApps.Metro;component/Styles/Accents/{0}.xaml", _setting.Accent));
             Application.Current.Resources.MergedDictionaries.Add(rdiction);
             rdiction1.Source = new Uri(string.Format("pack://application:,,,/MahApps.Metro;component/Styles/Accents/{0}.xaml", _setting.Theme));
             Log.Info("After: to get list of setting variable from DB, Successfully in LoadingWindow");
         }
         else
         {
             Log.Info("Before: to get list of setting variable from DB in LoadingWindow");
             Inventory.Model.Setting _S = _Sp.First();//DatabaseAndQueries.Queries.GetDataByCondition<Inventory.Model.Setting>(x => x.Id == 1);
             Log.Info("After: to get list of setting variable from DB, Successfully in LoadingWindow");
             rdiction.Source = new Uri(string.Format("pack://application:,,,/MahApps.Metro;component/Styles/Accents/{0}.xaml", _S.Accent));
             Application.Current.Resources.MergedDictionaries.Add(rdiction);
             rdiction1.Source = new Uri(string.Format("pack://application:,,,/MahApps.Metro;component/Styles/Accents/{0}.xaml", _S.Theme));
             Log.Info("After: to get list of setting variable from DB, Successfully in LoadingWindow");
         }
         List <LoginUser> _lst = Queries.GetAllData <LoginUser>();
         if (_lst.Count == 0)
         {
             new MasterPassword().Show();
         }
         else
         {
             LoginUser _lu = _lst.First <LoginUser>();
             if (_lu.Trial.Date <= DateTime.Now.Date)
             {
                 new TrialExpireWindow().Show();           // send to expire window.
                 Log.Info("After: To show trail Expire window, in LoadingWindow");
             }
             else
             {
                 Application.Current.Resources.MergedDictionaries.Add(rdiction);
                 Application.Current.Resources.MergedDictionaries.Add(rdiction1);
                 new Login().Show();
             }
         }
         newslider.Stop();
         count = 0;
         this.Close();
     }
 }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Log.Info("Before: load datatable of standard report in Standard_Customer");
            DataSet   Ds = new DataSet();
            DataTable dt = new DataTable();
            float     sale = 0, purcahse = 0, remainbalance = 0;

            dt.Columns.Add("BillNo");
            dt.Columns.Add("SaleDate");
            dt.Columns.Add("Product");
            dt.Columns.Add("Qty");
            dt.Columns.Add("Price");
            //dt.Columns.Add("TotalAmount");
            //dt.Columns.Add("Advance");
            dt.Columns.Add("Sale");
            dt.Columns.Add("Purchase");

            foreach (Sale item in saleslst)
            {
                DataRow _r = dt.NewRow();
                if (item.Type)
                {
                    _r["BillNo"]   = item.Billing;
                    _r["Sale"]     = item.TotalAmount;
                    _r["Purchase"] = string.Empty;
                    sale           = sale + item.TotalAmount;
                }
                else
                {
                    _r["BillNo"]   = item.PurchaseBill;
                    _r["Sale"]     = string.Empty;
                    _r["Purchase"] = item.TotalAmount;
                    purcahse       = purcahse + item.TotalAmount;
                }
                //if (productname == "Hello")
                //{
                //    List<Sale> _lst = Queries.GetAllByCondition<Sale>(x => x.Customer.Cname.ToUpper() == customername);
                //    foreach (Sale items in _lst)
                //    {
                //        remainbalance = remainbalance + items.RemainingBalance;
                //    }
                //}
                _r["SaleDate"] = item.SaleDate.ToString("dd-MM-yyyy");
                _r["Product"]  = item.Product.Pname;
                _r["Qty"]      = item.Quantity;
                _r["Price"]    = item.Price;


                // _r["TotalAmount"] = item.TotalAmount;
                //   _r["Advance"] = item.Advance;

                dt.Rows.Add(_r);
            }
            var p = remainbalance;

            Ds.Tables.Add(dt);
            Log.Info("Before: getting setting data of standard report in Standard_Customer");

            string Apppath = System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);

            if (Apppath.IndexOf("\\bin\\Debug") != -1)
            {
                Apppath = Apppath.Remove(Apppath.IndexOf("\\bin\\Debug"));
            }
            Log.Info("Before : To get setting record from db in Standard_Customer");
            Inventory.Model.Setting _Setting = DatabaseAndQueries.Queries.GetDataByCondition <Inventory.Model.Setting>
                                                   (x => x.Id == 1);
            string[] address = _Setting.Address.Split('$');
            Log.Info("After: To get setting record from db in Standard_Customer");
            /*Report Parameters*/
            /*image parametere*/

            ReportParameter companyName = new ReportParameter("comanyName", _Setting.CompanyName.ToUpper());

            ReportParameter addressLine1 = new ReportParameter("addressLine1", address[0].ToUpper() + ", " + address[1].ToUpper());
            ReportParameter addressLine2 = new ReportParameter("addressLine2", address[2].ToUpper() + ", " + address[3].ToUpper());
            ReportParameter contact      = new ReportParameter("contact", _Setting.ContactNo.ToString());

            Log.Info("After: getting setting data of standard report, successfully in Standard_Customer");
            Log.Info("Before: set parameter of standard report in Standard_Customer");

            ReportParameter Nameparam       = new ReportParameter("Nameparam", customername);
            ReportParameter Dateparam       = new ReportParameter("Dateparam", Fdate);
            ReportParameter SecondDateparam = new ReportParameter("SecondDateparam", Ldate);
            //if (productname == "Hello")
            //{
            //    productname = remainbalance.ToString();
            //}

            ReportParameter prodparam = new ReportParameter("prodparam", productname);

            ReportParameter secondstringparam     = new ReportParameter("secondstringparam", secondstring);
            ReportParameter firststringparam      = new ReportParameter("firststringparam", firststring);
            ReportParameter datestringparam       = new ReportParameter("datestringparam", firstdatestring);
            ReportParameter seconddatestringparam = new ReportParameter("seconddatestringparam", seconddatestring);
            ReportParameter salesumparam          = new ReportParameter("salesumparam", sale.ToString());
            ReportParameter Purchasesumparam      = new ReportParameter("Purchasesumparam", purcahse.ToString());


            ReportDataSource reportDataSource = new ReportDataSource("GridDataSet", dt);


            reportViewer.LocalReport.EnableExternalImages   = true;
            reportViewer.LocalReport.ReportEmbeddedResource = "Inventory.Reports.StandardReport.rdlc";
            this.reportViewer.LocalReport.SetParameters(new ReportParameter[] { companyName, addressLine1, addressLine2,
                                                                                contact, Nameparam,
                                                                                Dateparam, SecondDateparam, prodparam
                                                                                , secondstringparam, firststringparam,
                                                                                datestringparam, seconddatestringparam, salesumparam, Purchasesumparam });
            Log.Info("After: set parameter of standard report in Standard_Customer");
            this.reportViewer.LocalReport.DataSources.Clear();
            reportViewer.LocalReport.DataSources.Add(reportDataSource);
            reportViewer.RefreshReport();
            Log.Info("After:successful load datatable of standard report in Standard_Customer");
        }
コード例 #6
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            Log.Info("Before : To generate report in AllCustomer");
            DataSet   Ds = new DataSet();
            DataTable dt = new DataTable();

            dt.Columns.Add("Cid");
            dt.Columns.Add("Cname");
            dt.Columns.Add("Address");
            dt.Columns.Add("ContactNo");
            dt.Columns.Add("Email");
            dt.Columns.Add("Date");
            Log.Info("Before : To get List of all customer in AllCustomer");
            List <Customer> _lst = Queries.GetAllData <Customer>();

            Log.Info("After : To get List of all customer in AllCustomer");
            foreach (Customer item in _lst)
            {
                DataRow _r = dt.NewRow();
                _r["Cid"]       = item.Cid;
                _r["Cname"]     = item.Cname;
                _r["Address"]   = item.Address;
                _r["ContactNo"] = item.ContactNo;
                _r["Email"]     = item.Email;
                _r["Date"]      = item.Date;
                dt.Rows.Add(_r);
            }
            Ds.Tables.Add(dt);

            string Apppath = System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);

            if (Apppath.IndexOf("\\bin\\Debug") != -1)
            {
                Apppath = Apppath.Remove(Apppath.IndexOf("\\bin\\Debug"));
            }
            Log.Info("Before : To get setting record from db in AllCustomer");
            Inventory.Model.Setting _Setting = DatabaseAndQueries.Queries.GetDataByCondition <Inventory.Model.Setting>
                                                   (x => x.Id == 1);
            Log.Info("After : To get setting record from db in AllCustomer");
            string[] address = _Setting.Address.Split('$');
            /*Report Parameters*/
            /*image parametere*/
            //   ReportParameter imageParam = new ReportParameter("imageParam", "file:///" + Apppath + "\\Images\\logo.png");

            ReportParameter companyName = new ReportParameter("comanyName", _Setting.CompanyName.ToUpper());

            ReportParameter addressLine1 = new ReportParameter("addressLine1", address[0].ToUpper());
            ReportParameter addressLine2 = new ReportParameter("addressLine2", address[1].ToUpper());
            ReportParameter addressLine3 = new ReportParameter("addressLine3", address[2].ToUpper());
            ReportParameter addressLine4 = new ReportParameter("addressLine4", address[3].ToUpper());
            ReportParameter contact      = new ReportParameter("contact", _Setting.ContactNo.ToString());

            ReportDataSource reportDataSource = new ReportDataSource("DataSet1", dt);


            reportViewer.LocalReport.EnableExternalImages   = true;
            reportViewer.LocalReport.ReportEmbeddedResource = "Inventory.Reports.SearchAllCustomer.rdlc";
            this.reportViewer.LocalReport.SetParameters(new ReportParameter[] {// imageParam,
                companyName, addressLine1, addressLine2, addressLine3, addressLine4, contact
            });
            this.reportViewer.LocalReport.DataSources.Clear();
            reportViewer.LocalReport.DataSources.Add(reportDataSource);
            reportViewer.RefreshReport();
            Log.Info("After : To generate report in AllCustomer");
        }