Пример #1
0
        private bool GetSale()
        {
            try
            {
                string text = TxtSearch.Text.Trim();

                using (var context = new RubberSoftEntities())
                {
                    SetTime();

                    if (text == "")
                    {
                        var query = context.spt_GetSale().Where(o => o.SaleDate >= StartDate &&
                                                                o.SaleDate <= EndDate).ToList();

                        GridSale.DataSource = query;
                    }
                    else
                    {
                        var query = context.spt_GetSale().Where(o => o.SaleDate >= StartDate &&
                                                                o.SaleDate <= EndDate && (o.SaleNumber.Contains(text) ||
                                                                                          o.CustomerName.Contains(text))).ToList();

                        GridSale.DataSource = query;
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
                return(false);
            }
        }
Пример #2
0
        private bool GetSaleData(GridView view)
        {
            try
            {
                sSaleId = Convert.ToInt32(view.GetFocusedRowCellValue("SaleId"));

                using (var context = new RubberSoftEntities())
                {
                    var query = context.spt_GetSale().Where(o => o.SaleId == sSaleId).ToList();
                    if (query.Count > 0)
                    {
                        foreach (spt_GetSale_Result dt in query)
                        {
                            strSaleNumber          = dt.SaleNumber;
                            TxtSaleNumber.Text     = dt.SaleNumber;
                            DtSaleDate.DateTime    = dt.SaleDate.Value;
                            sCustomerId            = dt.CustomerId.Value;
                            TxtCustomerName.Text   = dt.CustomerName;
                            SpinSubTotal.Value     = dt.SubTotal.Value;
                            SpinDownValue.Value    = dt.DownValue.Value;
                            SpinNetTotal.Value     = dt.NetTotal.Value;
                            SpinSetOffValue.Value  = dt.SetOffValue.Value;
                            SpinValueBalance.Value = dt.ValueBalance.Value;
                            sActive        = dt.Active.Value;
                            sProductTypeId = dt.ProductTypeId.Value;
                        }

                        GetCustomer(sCustomerId);
                        GetSaleProduct(sSaleId);
                        LoadProductType(sProductTypeId);
                        GetValueBalance(sCustomerId);

                        if (sActive == false)
                        {
                            BtnCancelSale.Enabled = false;
                        }
                        else
                        {
                            BtnCancelSale.Enabled = true;
                        }
                    }
                    else
                    {
                        ClearData();
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
                return(false);
            }
        }
Пример #3
0
 private bool CheckData(int SaleId)
 {
     try
     {
         using (var context = new RubberSoftEntities())
         {
             var query = context.spt_GetSale().Where(o => o.SaleId == SaleId).ToList();
             if (query.Count > 0)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.Message);
         return(false);
     }
 }