示例#1
0
        private void btnDeleteProductExportDetail_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtTransQuantity.Text == "")
                {
                    XtraMessageBox.Show("You have to choose at least 1 record to delete!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }


                SaleInvoiceDetails_DTO invoice = new SaleInvoiceDetails_DTO();
                invoice.TransDetailsID = txtTransDetailsID.Text;
                invoice.TransChange    = Convert.ToInt32(dtgvDetailBillSale.CurrentRow.Cells["TransQuantity"].Value.ToString());
                invoice.ProductID      = cmbIDProductDetailStore.Text;

                if (SaleInvoiceDetails_BUS.DeleteSaleInvoiceDetails(invoice))
                {
                    LoadSaleInvoice();
                    LoadSaleInvoiceDetails();
                    LoadProduct();
                    uctProduct.uctSPCH.LoadProductList();
                    XtraMessageBox.Show("Delete detail sucessfully!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    ClearDisplay1();
                    return;
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show("Delete detail failed!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
示例#2
0
        public static bool InsertSaleInvoiceDetails(SaleInvoiceDetails_DTO invoice)
        {
            SqlConnection con = DataProvider.OpenConnection();

            cmd = new SqlCommand("[JEWELRYSTOREMGMT].[dbo].[usp_insertSaleInvoice_Details]", con);

            try
            {
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                SqlParameter p = new SqlParameter("@TransID", invoice.TransID);
                cmd.Parameters.Add(p);
                p = new SqlParameter("@ProductID", invoice.ProductID);
                cmd.Parameters.Add(p);
                p = new SqlParameter("@TransQuantity", invoice.TransQuantity);
                cmd.Parameters.Add(p);
                p = new SqlParameter("@TransPrice", invoice.TransPrice);
                cmd.Parameters.Add(p);
                p = new SqlParameter("@Total", invoice.Total);
                cmd.Parameters.Add(p);

                cmd.ExecuteNonQuery();

                DataProvider.CloseConnection(con);
                return(true);
            }
            catch
            {
                DataProvider.CloseConnection(con);
                return(false);
            }
        }
示例#3
0
        public static bool DeleteSaleInvoiceDetails(SaleInvoiceDetails_DTO invoice)
        {
            SqlConnection con = DataProvider.OpenConnection();

            try
            {
                cmd             = new SqlCommand("[JEWELRYSTOREMGMT].[dbo].[usp_deleteSaleInvoice_Details]", con);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlParameter p = new SqlParameter("@TransDetailsID", invoice.TransDetailsID);
                cmd.Parameters.Add(p);
                p = new SqlParameter("@TransChange", invoice.TransChange);
                cmd.Parameters.Add(p);
                p = new SqlParameter("@ProductID", invoice.ProductID);
                cmd.Parameters.Add(p);

                cmd.ExecuteNonQuery();

                DataProvider.CloseConnection(con);
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Notification", MessageBoxButtons.OK, MessageBoxIcon.Error);
                DataProvider.CloseConnection(con);
                return(false);
            }
        }
示例#4
0
        private void btnAddProductExportDetail_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtTransQuantity.Text == "")
                {
                    XtraMessageBox.Show("You have to input quantity!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                int num;
                if (txtTransQuantity.Text == "")
                {
                    num = 0;
                }
                else
                {
                    num = Convert.ToInt32(txtTransQuantity.Text.ToString());
                }

                int num1 = Convert.ToInt32(cmbPQuatity.Text.ToString());


                if (num > num1)
                {
                    XtraMessageBox.Show("Not enough products in store!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtTransQuantity.Text = "";
                    return;
                }
                else
                {
                    SaleInvoiceDetails_DTO invoice = new SaleInvoiceDetails_DTO();
                    invoice.TransID       = cmbIDBillExportDetail.Text;
                    invoice.ProductID     = cmbIDProductDetailStore.Text;
                    invoice.TransQuantity = Convert.ToInt32(txtTransQuantity.Text);
                    invoice.TransPrice    = txtTransPrice.Text;
                    invoice.Total         = txtTotal.Text;

                    if (SaleInvoiceDetails_BUS.InsertSaleInvoiceDetails(invoice))
                    {
                        LoadSaleInvoice();
                        LoadSaleInvoiceDetails();
                        LoadProduct();
                        uctProduct.uctSPCH.LoadProductList();
                        XtraMessageBox.Show("Insert detail sucessfully!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        ClearDisplay1();
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
示例#5
0
        private void btnUpdateProductExportDetail_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtTransQuantity.Text == "")
                {
                    XtraMessageBox.Show("You have to input quantity!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                int originQuantity = Convert.ToInt32(dtgvDetailBillSale.CurrentRow.Cells["TransQuantity"].Value.ToString());
                int newQuantity    = Convert.ToInt32(txtTransQuantity.Text.ToString());
                int change         = newQuantity - originQuantity;

                int prodQuantity = Convert.ToInt32(cmbPQuatity.Text.ToString());

                if (change > prodQuantity)
                {
                    XtraMessageBox.Show("Not enough products in store!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtTransQuantity.Text = "";
                    return;
                }

                SaleInvoiceDetails_DTO invoice = new SaleInvoiceDetails_DTO();
                invoice.TransID        = cmbIDBillExportDetail.Text;
                invoice.TransDetailsID = txtTransDetailsID.Text;
                invoice.ProductID      = cmbIDProductDetailStore.Text;
                invoice.TransQuantity  = Convert.ToInt32(txtTransQuantity.Text);
                invoice.TransChange    = change;
                invoice.TransPrice     = txtTransPrice.Text;
                invoice.Total          = txtTotal.Text;

                if (SaleInvoiceDetails_BUS.UpdateSaleInvoiceDetails(invoice))
                {
                    LoadSaleInvoice();
                    LoadSaleInvoiceDetails();
                    LoadProduct();
                    uctProduct.uctSPCH.LoadProductList();
                    XtraMessageBox.Show("Update detail sucessfully!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    ClearDisplay1();
                    return;
                }
            }
            catch
            {
                XtraMessageBox.Show("Update detail failed!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
示例#6
0
        public static List <SaleInvoiceDetails_DTO> LoadSaleInvoiceDetails(int transId)
        {
            SqlConnection con = DataProvider.OpenConnection();

            try
            {
                cmd             = new SqlCommand("[JEWELRYSTOREMGMT].[dbo].[usp_getSaleInvoice_Details]", con);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlParameter p = new SqlParameter("@TransID", transId);
                cmd.Parameters.Add(p);

                cmd.ExecuteNonQuery();
                da = new SqlDataAdapter();
                da.SelectCommand = cmd;
                dt = new DataTable();

                da.Fill(dt);
            }
            catch
            {
                return(null);
            }

            if (dt.Rows.Count == 0)
            {
                return(null);
            }

            List <SaleInvoiceDetails_DTO> saleInvoiceDetailsList = new List <SaleInvoiceDetails_DTO>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                SaleInvoiceDetails_DTO saleInvoiceDetails = new SaleInvoiceDetails_DTO();
                saleInvoiceDetails.TransDetailsID      = dt.Rows[i]["TransDetailsID"].ToString();
                saleInvoiceDetails.ProductID           = dt.Rows[i]["ProductID"].ToString();
                saleInvoiceDetails.ProductName         = dt.Rows[i]["ProductName"].ToString();
                saleInvoiceDetails.ProductCategoryName = dt.Rows[i]["ProductCategoryName"].ToString();
                saleInvoiceDetails.TransQuantity       = Convert.ToInt32(dt.Rows[i]["TransQuantity"].ToString());
                saleInvoiceDetails.UnitName            = dt.Rows[i]["UnitName"].ToString();
                saleInvoiceDetails.TransPrice          = dt.Rows[i]["TransPrice"].ToString();
                saleInvoiceDetails.Total = dt.Rows[i]["Total"].ToString();

                saleInvoiceDetailsList.Add(saleInvoiceDetails);
            }
            DataProvider.CloseConnection(con);
            return(saleInvoiceDetailsList);
        }
示例#7
0
 public static bool DeleteSaleInvoiceDetails(SaleInvoiceDetails_DTO invoice)
 {
     return(SaleInvoiceDetails_DAL.DeleteSaleInvoiceDetails(invoice));
 }
示例#8
0
 public static bool UpdateSaleInvoiceDetails(SaleInvoiceDetails_DTO invoice)
 {
     return(SaleInvoiceDetails_DAL.UpdateSaleInvoiceDetails(invoice));
 }
示例#9
0
 public static bool InsertSaleInvoiceDetails(SaleInvoiceDetails_DTO invoice)
 {
     return(SaleInvoiceDetails_DAL.InsertSaleInvoiceDetails(invoice));
 }