Exemple #1
0
        public bool ExcuteSQL(string sql)
        {
            bool i = true;

            try
            {
                OracleConnection conn = new OracleConnection(StaticFunctionData.ConnString);
                switch (conn.State.ToString() != "Open")
                {
                case true:
                    conn.Open();
                    break;
                }
                OracleCommand cmd = new OracleCommand(sql, conn);
                cmd.ExecuteNonQuery();
                //conn.Close();
            }
            catch (Exception ex)
            {
                i = false;
                Console.WriteLine("ERROR ====>");
                Console.WriteLine(sql);
                Console.WriteLine(ex.Message);
                GreeterFunction.Logs(ex.Message);
                Console.WriteLine("END ====>");
                throw ex;
            }
            return(i);
        }
Exemple #2
0
        public DataSet GetFill(string sql)
        {
            DataSet dr = new DataSet();

            try
            {
                OracleConnection conn = new OracleConnection(StaticFunctionData.ConnString);
                switch (conn.State.ToString() != "Open")
                {
                case true:
                    conn.Open();
                    break;
                }
                OracleDataAdapter da = new OracleDataAdapter(sql, conn);
                da.Fill(dr);
                //conn.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR ====>");
                Console.WriteLine(sql);
                Console.WriteLine(ex);
                GreeterFunction.Logs(ex.Message);
                Console.WriteLine("END ====>");
                //throw ex;
            }
            return(dr);
        }
        public List <SetPlData> GetPlData(string refinv)
        {
            List <SetPlData> obj = new List <SetPlData>();
            string           sql = $"SELECT * FROM TBT_PLDIM d where d.issuingkey = '{refinv}'";

            Console.WriteLine(sql);
            DataSet dr = new ConnDB().GetFill(sql);

            foreach (DataRow r in dr.Tables[0].Rows)
            {
                string pltype = new GreeterFunction().GetPlSize(r["pldim"].ToString(), int.Parse(r["ctn"].ToString()));
                string plno   = new GreeterFunction().GetPlList(r["issuingkey"].ToString(), pltype);
                int    plqty  = new GreeterFunction().GetPlQty(r["issuingkey"].ToString(), plno);
                obj.Add(new SetPlData()
                {
                    id     = obj.Count + 1,
                    RefInv = r["refinvoice"].ToString(),
                    RefNo  = r["issuingkey"].ToString(),
                    plno   = plno,
                    pldim  = r["pldim"].ToString(),
                    pltype = pltype,
                    qty    = plqty,
                    ctn    = int.Parse(r["ctn"].ToString()),
                    unit   = r["unit"].ToString(),
                });
            }
            return(obj);
        }
Exemple #4
0
        private void bbiPlConfirm_ItemClick(object sender, ItemClickEventArgs e)
        {
            //InvoiceConfirmInvForm frm = new InvoiceConfirmInvForm(ob.RefInv);
            //frm.ShowDialog();
            //bool chinvconfirm = new GreeterFunction().CheckUpdateInvoice(DateTime.Parse(bbiEtd.EditValue.ToString()));
            //if (chinvconfirm)
            //{
            //    string invno = bbiRefInv.EditValue.ToString();
            //    string invoiceno = new GreeterFunction().GetLastInvoice(invno);
            //    var result = XtraInputBox.Show("ระบุเลขที่เอกสาร", "ยืนยันการสร้าง Invoice", invoiceno);
            //    if (result.Length > 0)
            //    {
            //        string sql = $"UPDATE TXP_ISSTRANSENT e SET e.REFINVOICE = '{result}' WHERE e.ISSUINGKEY = '{invno}'";
            //        if (new ConnDB().ExcuteSQL(sql))
            //        {
            //            XtraMessageBox.Show("บันทึกข้อมูลเสร็จแล้ว");
            //            bbiInv.EditValue = invoiceno;
            //        }
            //    }
            //}
            string invno     = bbiRefInv.EditValue.ToString();
            string invoiceno = new GreeterFunction().GetLastInvoice(invno);
            var    result    = XtraInputBox.Show("ระบุเลขที่เอกสาร", "ยืนยันการสร้าง Invoice", invoiceno);

            if (result.Length > 0)
            {
                string sql = $"UPDATE TXP_ISSTRANSENT e SET e.REFINVOICE = '{result}' WHERE e.ISSUINGKEY = '{invno}'";
                if (new ConnDB().ExcuteSQL(sql))
                {
                    XtraMessageBox.Show("บันทึกข้อมูลเสร็จแล้ว");
                    bbiInv.EditValue = invoiceno;
                }
            }
        }
        public InvoiceAddNewPalletForm(string refinv)
        {
            InitializeComponent();
            invno     = refinv;
            this.Text = $"ADD PALLET";
            List <INJPlData> obj = new GreeterFunction().GetPalletData(invno);

            foreach (var r in obj)
            {
                cbPlSize.Properties.Items.Add(r.PSize);
            }
        }
Exemple #6
0
        private void gridView_DoubleClick(object sender, EventArgs e)
        {
            OrderData       obj = gridView.GetFocusedRow() as OrderData;
            OrderDetailForm frm = new OrderDetailForm(obj);

            frm.ShowDialog();
            int st = new GreeterFunction().GetInvoiceStatus(obj.RefNo);

            gridView.SetFocusedRowCellValue("Status", st);
            gridView.UpdateCurrentRow();
            gridView.UpdateTotalSummary();
        }
Exemple #7
0
        private void bbiConfirm_ItemClick(object sender, ItemClickEventArgs e)
        {
            string invoiceno = new GreeterFunction().GetLastInvoice(invno);
            var    result    = XtraInputBox.Show("ระบุเลขที่เอกสาร", "ยืนยันการสร้าง Invoice", invoiceno);

            if (result.Length > 0)
            {
                string sql = $"UPDATE TXP_ISSTRANSENT e SET e.REFINVOICE = '{result}' WHERE e.ISSUINGKEY = '{invno}'";
                if (new ConnDB().ExcuteSQL(sql))
                {
                    XtraMessageBox.Show("บันทึกข้อมูลเสร็จแล้ว");
                }
            }
        }
        bool UpdatePlInvoice(string refno, string plnum, string pltype, string ctn)
        {
            bool checkpl = new GreeterFunction().CheckPlDuplicate(refno, plnum);
            //insert
            string ins = $"INSERT INTO TXP_ISSPALLET(FACTORY, ISSUINGKEY, PALLETNO, PLTYPE, PLOUTSTS, UPDDTE, SYSDTE, PLTOTAL, BOOKED)\n" +
                         $"VALUES('{StaticFunctionData.Factory}', '{refno}', '{plnum}', '{pltype}', 0, current_timestamp, current_timestamp, {ctn}, 0)";

            if (checkpl)
            {
                //update
                ins = $"UPDATE TXP_ISSPALLET SET PLTYPE='{pltype}', UPDDTE=current_timestamp, PLTOTAL={ctn}\n" +
                      $"WHERE ISSUINGKEY = '{refno}' AND PALLETNO = '{plnum}'";
            }
            return(new ConnDB().ExcuteSQL(ins));
        }
        private void bbiConfirmInvoice_ItemClick(object sender, ItemClickEventArgs e)
        {
            string invoiceno = new GreeterFunction().GetLastInvoice(refno.Replace("'", "").Trim());
            var    result    = XtraInputBox.Show("ระบุเลขที่เอกสาร", "ยืนยันการสร้าง Invoice", invoiceno);

            if (result.Length > 0)
            {
                string sql    = $"UPDATE TXP_ISSTRANSENT e SET e.REFINVOICE = '{result}',e.ISSUINGSTATUS=2 WHERE e.ISSUINGKEY = '{refno.Replace("'", "").Trim()}'";
                string sqlord = $"UPDATE TXP_ORDERPLAN e SET e.ORDERSTATUS=2 WHERE e.CURINV = '{refno.Replace("'", "").Trim()}'";
                new ConnDB().ExcuteSQL(sqlord);
                if (new ConnDB().ExcuteSQL(sql))
                {
                    XtraMessageBox.Show("บันทึกข้อมูลเสร็จแล้ว");
                    ReloadData();
                }
            }
        }
        private void bbiDelete_ItemClick(object sender, ItemClickEventArgs e)
        {
            var          fno = gridView.GetFocusedRowCellValue("FTicketNo");
            DialogResult r   = XtraMessageBox.Show($"คุณต้องการตัด Short {fno.ToString()} นี้ใช่หรือไม่", "ยืนยันคำสั่ง", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (r == DialogResult.Yes)
            {
                bool x = new ConnDB().ExcuteSQL($"UPDATE TXP_ISSPACKDETAIL d SET d.ISSUINGSTATUS = 3 WHERE d.FTICKETNO = '{fno}'");
                if (x)
                {
                    int ctn = int.Parse(gridView.GetFocusedRowCellValue("OrderQty").ToString());
                    int xn  = new GreeterFunction().GetShortQty(gridView.GetFocusedRowCellValue("PartNo").ToString(), ob.RefInv, ctn);
                    new ConnDB().ExcuteSQL($"UPDATE TXP_ISSTRANSBODY d SET d.SHORDERQTY = {xn} WHERE d.PARTNO = '{gridView.GetFocusedRowCellValue("PartNo")}' and d.ISSUINGKEY = '{ob.RefInv}'");
                    gridView.SetFocusedRowCellValue("Status", 3);
                    XtraMessageBox.Show("บันทึกข้อมูลเสร็จแล้ว");
                }
            }
            return;
        }
        public async Task Test_JsonRequestBody_ReturnsOkObjectResult()
        {
            // Arrange
            using var stream =
                      new MemoryStream(
                          System.Text.Encoding.UTF8.GetBytes("{\"name\":\"jan\"}")
                          );

            Mock.Get(request)
            .SetupGet(r => r.Body)
            .Returns(stream);

            // Act
            var response = await GreeterFunction
                           .ExecuteAsync(request, logger)
                           .ConfigureAwait(false);

            // Assert
            Assert.IsInstanceOf <OkObjectResult>(response);
        }
Exemple #12
0
 void UpdateContainer(BookingInvoicePallet pl)
 {
     try
     {
         string   sql           = $"select * from txp_loadcontainer where containerno = '{bbiContainer.EditValue.ToString().ToUpper()}'";
         DateTime d             = DateTime.Parse(bbiRelDate.EditValue.ToString());
         string   txttime       = $"{d.ToString("dd/MM/yyyy")} {bbiRelTimer.EditValue.ToString().Substring(10, 9).Trim()}";
         DateTime dx            = DateTime.Parse(bbiEtd.EditValue.ToString());
         string   containersize = "20F";
         if (bbi4oFt.Checked)
         {
             containersize = "40F";
         }
         DataSet dr        = new ConnDB().GetFill(sql);
         string  sqlupdate = $"update txp_loadcontainer set etddte=to_date('{dx.ToString("dd/MM/yyyy")}', 'DD/MM/YYYY')," +
                             $"sealno='{bbiSealNo.EditValue.ToString().ToUpper()}',containersize='{containersize}'," +
                             $"receivedte=to_date('{d.ToString("dd/MM/yyyy")}', 'DD/MM/YYYY')," +
                             $"releasedte=to_date('{txttime}', 'DD/MM/YYYY HH24:MI:SS'),upddte=sysdate\n" +
                             $"where containerno='{bbiContainer.EditValue.ToString().ToUpper()}'";
         if (dr.Tables[0].Rows.Count <= 0)
         {
             sqlupdate = "insert into txp_loadcontainer(containerno,custname,etddte,sealno,containersize,receivedte,releasedte,sysdte,upddte) \n" +
                         "values \n" +
                         $"('{bbiContainer.EditValue.ToString().ToUpper()}', " +
                         $"'{pl.custname.Trim().ToUpper()}', " +
                         $"to_date('{dx.ToString("dd/MM/yyyy")}', 'DD/MM/YYYY'), '{bbiSealNo.EditValue.ToString().ToUpper()}', " +
                         $"'{containersize}', to_date('{d.ToString("dd/MM/yyyy")}', 'DD/MM/YYYY'), " +
                         $"to_date('{txttime}', 'DD/MM/YYYY HH24:MI:SS'), sysdate, sysdate)";
         }
         new ConnDB().ExcuteSQL(sqlupdate);
         new ConnDB().ExcuteSQL($"UPDATE TXP_LOADPALLET SET CONTAINERNO = '{bbiContainer.EditValue.ToString().ToUpper()}' WHERE PLOUTNO = '{pl.ploutno}'");
     }
     catch (Exception ex)
     {
         GreeterFunction.Logs(ex.Message);
     }
 }