Exemple #1
0
        private void btnUpdateBillImport_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtIDBillImport.Text == "")
                {
                    XtraMessageBox.Show("You have to choose at least one invoice to update", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                PostInvoice_DTO invoice = new PostInvoice_DTO();
                invoice.TransID    = Convert.ToInt32(dtgvInfoListOfBillImport.CurrentRow.Cells["TransID"].Value);
                invoice.VendorID   = Convert.ToInt32(txtVendorId.Text);
                invoice.CreateDate = Convert.ToDateTime(dtpkDateTimeImport.Text.ToString());

                if (PostInvoice_BUS.UpdatePostInvoice(invoice))
                {
                    LoadPostInvoice();
                    uctVendor.uctVendorInfo.LoadVendorList();
                    XtraMessageBox.Show("Update Post Invoice Successfully", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ClearDisplay();
                    return;
                }
            }catch
            {
                XtraMessageBox.Show("Update Post Invoice Failed!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
Exemple #2
0
        private void btnDeleteBillImport_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtIDBillImport.Text == "")
                {
                    XtraMessageBox.Show("You have to choose at least one invoice to delete", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                PostInvoice_DTO invoice = new PostInvoice_DTO();
                invoice.TransID = Convert.ToInt32(dtgvInfoListOfBillImport.CurrentRow.Cells["TransID"].Value);


                if (PostInvoice_BUS.DeletePostInvoice(invoice))
                {
                    LoadPostInvoice();
                    uctVendor.uctVendorInfo.LoadVendorList();
                    XtraMessageBox.Show("Delete Post Invoice Successfully", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ClearDisplay();
                    return;
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
Exemple #3
0
        public static bool UpdatePostInvoice(PostInvoice_DTO invoice)
        {
            SqlConnection con = DataProvider.OpenConnection();

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

                SqlParameter p = new SqlParameter("@TransID", invoice.TransID);
                cmd.Parameters.Add(p);
                p = new SqlParameter("@CreateDate", invoice.CreateDate);
                cmd.Parameters.Add(p);
                p = new SqlParameter("@VendorID", invoice.VendorID);
                cmd.Parameters.Add(p);


                cmd.ExecuteNonQuery();

                DataProvider.CloseConnection(con);
                return(true);
            }
            catch
            {
                DataProvider.CloseConnection(con);
                return(false);
            }
        }
Exemple #4
0
        private void btnAddImportBill_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtIDBillImport.Text == "" || txtVendorId.Text == "" || cmbIDAgency.Text == "")
                {
                    XtraMessageBox.Show("Missing Information!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                PostInvoice_DTO postInvoice = new PostInvoice_DTO();
                postInvoice.TransID    = Convert.ToInt32(txtIDBillImport.Text);
                postInvoice.VendorID   = Convert.ToInt32(txtVendorId.Text.ToString());
                postInvoice.CreateDate = Convert.ToDateTime(dtpkDateTimeImport.Text.ToString());
                postInvoice.VendorName = cmbIDAgency.Text.ToString();
                postInvoice.TotalPrice = 0;

                if (PostInvoice_BUS.InsertPostInvoice(postInvoice))
                {
                    XtraMessageBox.Show("Insert Post Invoice Successfully!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    cmbIDBillImportDetail.Text = txtIDBillImport.Text;
                    ClearDisplay();

                    uctVendor.uctVendorInfo.LoadVendorList();
                    LoadPostInvoice();
                    return;
                }
            }
            catch
            {
                XtraMessageBox.Show("Insert Post Invoice Failed!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
Exemple #5
0
        public static List <PostInvoice_DTO> PostInvoiceLoad()
        {
            SqlConnection con = DataProvider.OpenConnection();

            try
            {
                //con.ChangeDatabase("JEWELRYSTOREMGMT");
                cmd             = new SqlCommand("[JEWELRYSTOREMGMT].[dbo].[usp_getPostInvoice]", con);
                cmd.CommandType = CommandType.StoredProcedure;
                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 <PostInvoice_DTO> PostInvoiceList = new List <PostInvoice_DTO>();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                PostInvoice_DTO postInvoice = new PostInvoice_DTO();
                postInvoice.TransID    = Convert.ToInt32(dt.Rows[i]["TransID"].ToString());
                postInvoice.VendorID   = Convert.ToInt32(dt.Rows[i]["VendorID"].ToString());
                postInvoice.VendorName = dt.Rows[i]["VendorName"].ToString();
                postInvoice.Address    = dt.Rows[i]["Address"].ToString();
                postInvoice.PhoneNo    = dt.Rows[i]["PhoneNo"].ToString();
                postInvoice.CreateDate = Convert.ToDateTime(dt.Rows[i]["TransDate"].ToString());
                postInvoice.TotalPrice = Convert.ToDouble(dt.Rows[i]["TotalPrice"].ToString());
                PostInvoiceList.Add(postInvoice);
            }
            DataProvider.CloseConnection(con);
            return(PostInvoiceList);
        }
Exemple #6
0
        public static bool DeletePostInvoice(PostInvoice_DTO invoice)
        {
            SqlConnection con = DataProvider.OpenConnection();

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

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

                cmd.ExecuteNonQuery();

                DataProvider.CloseConnection(con);
                return(true);
            }
            catch (Exception ex)
            {
                DataProvider.CloseConnection(con);
                MessageBox.Show(ex.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
Exemple #7
0
 public static bool DeletePostInvoice(PostInvoice_DTO invoice)
 {
     return(PostInvoice_DAL.DeletePostInvoice(invoice));
 }
Exemple #8
0
 public static bool UpdatePostInvoice(PostInvoice_DTO invoice)
 {
     return(PostInvoice_DAL.UpdatePostInvoice(invoice));
 }
Exemple #9
0
 public static bool InsertPostInvoice(PostInvoice_DTO invoice)
 {
     return(PostInvoice_DAL.InsertPostInvoice(invoice));
 }