Пример #1
0
        public static DataTable InsertSalesParent(SaleMaster objSaleMaster)
        {
            ISalesPOSDBManager dbManager = new SalesPOSDBManager();
            DataTable          dt        = new DataTable();

            try
            {
                dbManager.Open();
                IDbDataParameter[] param = SalesPOSDBManagerFactory.GetParameters(dbManager.ProviderType, 12);
                param[0]  = dbManager.getparam("@SalesType", objSaleMaster.SalesType);
                param[1]  = dbManager.getparam("@CustomerCode", objSaleMaster.CustomerID);
                param[2]  = dbManager.getparam("@SalesmanID", objSaleMaster.SalemanID);
                param[3]  = dbManager.getparam("@SalesAmount", Convert.ToDouble(objSaleMaster.SalesAmount));
                param[4]  = dbManager.getparam("@TerminalID", Convert.ToInt32(objSaleMaster.TerminalID));
                param[5]  = dbManager.getparam("@CreatedBy", Convert.ToInt32(objSaleMaster.CreatedBy));
                param[6]  = dbManager.getparam("@CashPaid", Convert.ToDouble(objSaleMaster.CashPaid));
                param[7]  = dbManager.getparam("@CustomerName", objSaleMaster.CustomerName);
                param[8]  = dbManager.getparam("@CustomerAddress", objSaleMaster.CustomerAddress);
                param[9]  = dbManager.getparam("@CustomerPhone", objSaleMaster.CustomerPhone);
                param[10] = dbManager.getparam("@VehicleNo", objSaleMaster.VehicleNo);
                param[11] = dbManager.getparam("@PO_Number", objSaleMaster.PO_Number);

                IDbCommand cmd = dbManager.getCommand(CommandType.StoredProcedure, "[dbo].[insert_sales_master]", param);
                dt = dbManager.GetDataTable(cmd);
            }
            catch (Exception ex)
            {
                //return false;
            }
            finally
            {
                dbManager.Dispose();
            }
            return(dt);
        }
Пример #2
0
        public int createSale_master(SaleMaster SM)
        {
            dbCon.openCon();
            String st = "Pending";

            cmd = new SqlCommand("insert into Sales_master (sale_id,clt_id,sale_date,sale_total,sale_status) values('" + SM.sale_id + "','" + SM.clt_id + "','" + SM.sale_date + "','" + SM.sale_total + "','" + st + "')", dbCon.con);
            int status = cmd.ExecuteNonQuery();

            dbCon.closeCon();
            return(status);
        }
Пример #3
0
 public IActionResult UpdateSale([FromBody] SaleMaster _saleMaster)
 {
     try
     {
         return(new OkObjectResult(this.ISale.ActiveInactiveSale(_saleMaster)));
     }
     catch
     {
         return(BadRequest());
     }
 }
Пример #4
0
 public async Task <SaleMaster> AddAsync(SaleMaster sale)
 {
     try
     {
         this.context.SaleMasters.Add(sale);
         await(this.context.SaveChangesAsync());
         return(sale);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Пример #5
0
        public async Task <IActionResult> AddSale([FromBody] SaleMaster _saleMaster)
        {
            try
            {
                SaleMaster sm = await this.ISale.AddAsync(_saleMaster);

                return(new OkObjectResult(sm));
            }
            catch
            {
                return(BadRequest());
            }
        }
Пример #6
0
 public SaleMaster ActiveInactiveSale(SaleMaster sale)
 {
     try
     {
         SaleMaster sm = this.context.SaleMasters.Where(p => p.SaleId == sale.SaleId).FirstOrDefault();
         sm.IsActive = sale.IsActive;
         this.context.SaveChanges();
         return(sm);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
        public bool SaleTransection()
        {   //SaleTransection saleTransection
            bool result = false;

            try
            {
                SaleTransection saleTransection = new Common.SaleTransection();
                saleTransection.SaleDtl        = new List <SaleDtlMaster>();
                saleTransection.TransactionDtl = new Transaction();
                saleTransection.Sale           = new SaleMaster();

                SaleMaster saleMaster = new SaleMaster();
                saleMaster.Amount    = 2000;
                saleMaster.CustId    = 1;
                saleMaster.Date      = DateTime.Now;
                saleMaster.IsDelete  = false;
                saleMaster.UserId    = 1;
                saleTransection.Sale = saleMaster;

                // List<SaleMaster> saleList = new List<SaleMaster>();
                SaleDtlMaster objSale = new SaleDtlMaster()
                {
                    ItemId = 1, Quantity = 2, SaleId = 0, Remark = ""
                };
                saleTransection.SaleDtl.Add(objSale);
                saleTransection.SaleDtl.Add(objSale);

                Transaction transaction = new Transaction();
                transaction.Amount             = 1000;
                transaction.CustomUniqueId     = Convert.ToString(Guid.NewGuid());
                transaction.UserId             = 1;
                transaction.TransType          = "Cr";
                saleTransection.TransactionDtl = transaction;


                int returRresult = saleTransManager.InsertTransaction(saleTransection);
                if (returRresult != 0)
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
            }
            return(result);
        }
        private void btn_CreOdr_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txt_odrTot.Text))
                {
                    MessageBox.Show("You must get Order Total", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (Picker_ReqDate.Value.Date == DateTime.Today.Date)
                {
                    MessageBox.Show("You must select a Date", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (Picker_ReqDate.Value.Date <= DateTime.Today.Date)
                {
                    MessageBox.Show("You must select a Future Date", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (string.IsNullOrEmpty(txt_OcltId.Text))
                {
                    MessageBox.Show("You must select a Client", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    SalesOrderDBaccess SO = new SalesOrderDBaccess();

                    SaleMaster SM = new SaleMaster();
                    SM.sale_id    = txt_SOno.Text;
                    SM.clt_id     = txt_OcltId.Text;
                    SM.sale_date  = Picker_ReqDate.Value.Date;
                    SM.sale_total = Convert.ToInt32(txt_odrTot.Text);

                    int Status = SO.createSale_master(SM);
                    if (Status == 1)
                    {
                        MetroMessageBox.Show(this, "\n\nOrder Created succesfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MetroMessageBox.Show(this, "\n\nOrder Creation Fail", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    grid_Sales.DataSource = SO.getSalesOrders();
                    txt_SOno.Text         = SO.GetSaleId();

                    txt_OcltId.Text      = null;
                    txt_OcltName.Text    = null;
                    txt_OcltAdd.Text     = null;
                    txt_OcltEmail.Text   = null;
                    txt_CintContact.Text = null;
                    cmb_ProType.Text     = null;
                    cmb_ftype.Text       = null;
                    cmb_Brand.Text       = null;
                    cmb_Design.Text      = null;
                    cmb_size.Text        = null;
                    cmb_color.Text       = null;
                    txt_qty.Text         = null;
                    txt_odrTot.Text      = null;
                    Picker_ReqDate.ResetText();
                    datagrid_add.Rows.Clear();
                    datagrid_add.ClearSelection();
                    grid_IdNameItem.ClearSelection();
                    lb_SelectClt.Visible = true;
                }

                // PurDetails PD = new PurDetails();
                // PD.pd_id =
            }
            catch (SqlException)
            {
                MetroMessageBox.Show(this, "\n\nConnecton Failed", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (FormatException)
            {
                MetroMessageBox.Show(this, "\n\nInvalid Format", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (OutOfMemoryException)
            {
                MetroMessageBox.Show(this, "\n\nInsuffisent memory", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception)
            {
                MetroMessageBox.Show(this, "\n\nERROR", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #9
0
        private void Sale_Click(object sender, RoutedEventArgs e)
        {
            SaleMaster sale = new SaleMaster();

            sale.ShowDialog();
        }