예제 #1
0
        public void Update()
        {
            if (Convert.ToInt32(pid_txt.Tag) != 0 || Convert.ToInt32(oid_cmb.Tag) != 0 || Convert.ToInt32(bc_txt.Tag) != 0 || Convert.ToInt32(val_txt.Tag) != 0 || Convert.ToInt32(pd_dtp.Tag) != 0 || Convert.ToInt32(pt_cmb.Tag) != 0)
            {
                conn.DBopen();

                try
                {
                    conn.SqlQuery("UPDATE GmntPayment SET [ord_id] = '" + oid_cmb.Text + "',[buyer_code] = '" + bc_txt.Text + "',[val_USD] = '" + val_txt.Text + "',[val_LKR] = '" + lkr_txt.Text + "',[paydate] = '" + Convert.ToDateTime(pd_dtp.Text) + "',[payment_terms] = '" + pt_cmb.Text + "' WHERE [payment_id] = '" + pid_txt.Text + "'");
                    conn.InsQryEx();
                    MessageBox.Show("Updated Successfully !");
                    RefreshGrid();
                }

                catch (Exception er)
                {
                    MessageBox.Show(er.Message);
                }

                finally
                {
                    conn.DBclose();
                }
            }

            else
            {
                MessageBox.Show("Please slect a field");
            }
        }
예제 #2
0
 private void insertData()
 {
     conn.DBopen();
     try
     {
         decimal rup = Convert.ToDecimal(cost_txt.Text) * Currency.getCurrencyRate("USD", "LKR");
         conn.SqlQuery("INSERT INTO Gmnt_sample ([Samp_id], [ord_id], [Buyer_code], [cost_USD], [cost_LKR], [Delivered_date],[fashion_sketch] ) VALUES ('" + sam_txt.Text + "','" + oid_cmb.Text + "','" + bc_txt.Text + "','" + cost_txt.Text + "','" + rup + "','" + Convert.ToDateTime(date_dtp.Text) + "','" + fp_txt.Text + "')");
         conn.InsQryEx();
         MessageBox.Show("Added  Successfully ");
     }
     catch (Exception er)
     {
         MessageBox.Show(er.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     conn.DBclose();
 }
예제 #3
0
        public void Update()
        {
            if (Convert.ToInt32(bc_cmb.Tag) != 0 || Convert.ToInt32(oDate.Tag) != 0 || Convert.ToInt32(rDate.Tag) != 0 || Convert.ToInt32(cDate.Tag) != 0 || Convert.ToInt32(hs_txt.Tag) != 0 || Convert.ToInt32(yes_rad.Tag) != 0 || Convert.ToInt32(no_rad.Tag) != 0 || Convert.ToInt32(ov_txt.Tag) != 0 || Convert.ToInt32(ar_cmb.Tag) != 0 || Convert.ToInt32(ci_cmb.Tag) != 0)
            {
                con.DBopen();
                string stat = ChkTrans();

                try
                {
                    con.SqlQuery("UPDATE Orders SET [Buyer_code] = '" + bc_cmb.Text + "',[ord_date] = '" + Convert.ToDateTime(oDate.Text) + "',[req_ship_date] = '" + Convert.ToDateTime(rDate.Text) + "',[conf_ship_date] = '" + Convert.ToDateTime(cDate.Text) + "',[hs_code] = '" + hs_txt.Text + "',[order_val] = '" + ov_txt.Text + "',[trans_split]  = '" + stat + "',[article] = '" + ar_cmb.Text + "',[ci_no] = '" + ci_cmb.Text + "' WHERE [ord_id] = '" + id_txt.Text + "'");
                    con.InsQryEx();
                    MessageBox.Show("Updated Successfully !");
                    RefreshGrid();
                }

                catch (Exception er)
                {
                    MessageBox.Show(er.Message);
                }

                finally
                {
                    con.DBclose();
                }
            }

            else
            {
                MessageBox.Show("Please select a field");
            }
        }
예제 #4
0
        private void add_Click(object sender, EventArgs e)
        {
            if (addCliEmpty() == -1)
            {
                addCliEmptyErr();
            }

            else if (Validation.valEml(eml_txt.Text) == false)
            {
                MessageBox.Show("Invalid Email !", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                e11.ForeColor = System.Drawing.Color.Red;
                e11.Text      = "Enter a Valid Email Address";
            }
            else if (Validation.valTel(phn_txt) == false)
            {
                MessageBox.Show("Invalid Phone Number !", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                e9.ForeColor = System.Drawing.Color.Red;
                e9.Text      = "Enter a 10 Digit Phone Number !";
            }
            else
            {
                con.DBopen();
                try
                {
                    con.SqlQuery("INSERT INTO Buyer ([buyer_code],[company],[address],[country],[email]) values ('" + bc_txt.Text + "','" + cmp_txt.Text + "','" + st1_txt.Text + "','" + cntry_cmb.Text + "','" + eml_txt.Text + "')");
                    con.InsQryEx();
                    con.SqlQuery("INSERT INTO BuyerPhone ([buyer_code],[phone]) values (@code,@num)");
                    con.cmd.Parameters.AddWithValue("@code", bc_txt.Text);
                    con.cmd.Parameters.Add("@num", SqlDbType.Text);
                    con.cmd.Parameters["@num"].Value = phc_txt.Text + ' ' + phn_txt.Text;
                    con.InsQryEx();
                    MessageBox.Show("Added  Successfully ");
                }
                catch (Exception error)
                {
                    MessageBox.Show(error.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                con.DBclose();
            }
        }
예제 #5
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         String     strBLOBFilePath = @"C:\Users\BHAGI\Pictures\Screenshots\b.png";
         FileStream fsBLOBFile      = new FileStream(strBLOBFilePath, FileMode.Open, FileAccess.Read);
         Byte[]     bytBLOBData     = new Byte[fsBLOBFile.Length];
         fsBLOBFile.Read(bytBLOBData, 0, bytBLOBData.Length);
         fsBLOBFile.Close();
         conn.SqlQuery("INSERT INTO login Values('bolt','bole','1234','" + bytBLOBData + "')");
         conn.InsQryEx();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #6
0
        public void Delete(string sId)
        {
            conn.DBopen();
            try
            {
                conn.SqlQuery("DELETE FROM GmntPayment WHERE [payment_id] = '" + sId + "'");
                conn.InsQryEx();
                MessageBox.Show("Deleted Succesfully!");
            }

            catch (Exception er)
            {
                MessageBox.Show(er.Message);
            }
            finally
            {
                conn.DBclose();
            }
        }
예제 #7
0
        public void Delete(string oId)
        {
            con.DBopen();
            try
            {
                con.SqlQuery("DELETE FROM Orders WHERE [ord_id] = '" + oId + "'");
                con.InsQryEx();
                MessageBox.Show("Deleted Succesfully!");
            }

            catch (Exception er)
            {
                MessageBox.Show(er.Message);
            }
            finally
            {
                con.DBclose();
            }
        }
예제 #8
0
        private void add_Click(object sender, EventArgs e)
        {
            if (addOrdEmpyt() == -1)
            {
                addOrdEmptyErr();
            }
            else
            {
                ChkHs();
                ChkCi();
            }

            /* if(ts_cmb.Text == "Yes")
             * {
             *   b = true;
             * }
             * else
             * {
             *   b = false;
             * }*/



            if (addOrdEmpyt() == 0 || ChkHs() == 0 || ChkCi() == 0)
            {
                con.DBopen();
                string stat = ChkTrans();

                try
                {
                    con.SqlQuery("INSERT INTO Orders ([ord_id],[buyer_code],[ord_date],[req_ship_date],[conf_ship_date],[hs_code],[order_val],[trans_split],[article],[ci_no]) values ('" + id_txt.Text + "','" + bc_cmb.Text + "','" + Convert.ToDateTime(oDate.Text) + "','" + Convert.ToDateTime(rDate.Text) + "','" + Convert.ToDateTime(cDate.Text) + "','" + hs_txt.Text + "','" + double.Parse(ov_txt.Text) + "','" + stat + "','" + ar_cmb.Text + "','" + ci_cmb.Text + "')");
                    con.InsQryEx();
                    MessageBox.Show("Added  Successfully ");
                }
                catch (Exception error)
                {
                    MessageBox.Show(error.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                con.DBclose();
            }
        }
예제 #9
0
        public void Update()
        {
            if ((costUsd_txt.Tag != null && Convert.ToInt32(costUsd_txt.Tag) != 0) || Convert.ToInt32(oid_cmb.Tag) != 0 || Convert.ToInt32(date_dtp.Tag) != 0 || Convert.ToInt32(pic_pb.Tag) != 0 || Convert.ToInt32(sat_cmb.Tag) != 0)
            {
                chkUsd  = Convert.ToInt32(costUsd_txt.Tag);
                ordId   = Convert.ToInt32(oid_cmb.Tag);
                dateTag = Convert.ToInt32(date_dtp.Tag);
                picTag  = Convert.ToInt32(pic_pb.Tag);
                staTag  = Convert.ToInt32(sat_cmb.Tag);

                conn.DBopen();

                try
                {
                    conn.SqlQuery("UPDATE Gmnt_sample SET [ord_id] = '" + oid_cmb.Text + "',[Buyer_code] = '" + bc_txt.Text + "',[cost_USD] = '" + costUsd_txt.Text + "',[cost_LKR] = '" + costLkr_txt.Text + "',[Delivered_date] = '" + Convert.ToDateTime(date_dtp.Text) + "',[samp_status] = '" + sat_cmb.Text + "',[fashion_sketch] = '" + imgLoc + "' WHERE [Samp_id] = '" + sam_txt.Text + "'");
                    conn.InsQryEx();
                    MessageBox.Show("Updated Successfully !");
                    RefreshGrid();
                }

                catch (Exception er)
                {
                    MessageBox.Show(er.Message);
                }

                finally
                {
                    conn.DBclose();
                }
            }

            else
            {
                MessageBox.Show("Please slect a field");
                chkUsd  = 0;
                ordId   = 0;
                dateTag = 0;
                picTag  = 0;
                staTag  = 0;
            }
        }
예제 #10
0
        private void addPayDet()
        {
            conn.DBopen();
            decimal rup = Convert.ToDecimal(val_txt.Text) * Currency.getCurrencyRate("USD", "LKR");

            try
            {
                conn.SqlQuery("INSERT INTO GmntPayment ([payment_id],[ord_id],[buyer_code],[val_USD],[val_LKR],[paydate],[payment_terms]) values ('" + pid_txt.Text + "','" + oid_cmb.Text + "','" + bc_txt.Text + "','" + val_txt.Text + "','" + rup + "','" + Convert.ToDateTime(pd_dtp.Text) + "','" + pt_cmb.Text + "')");
                conn.InsQryEx();
                MessageBox.Show("Added  Successfully ");
                ClearTextBoxes();
            }

            catch (Exception er)
            {
                MessageBox.Show(er.Message);
            }
            finally
            {
                conn.DBclose();
            }
        }