예제 #1
0
        public async Task <JsonResult> UpdateHangJob()
        {
            try
            {
                HangJob hj = new HangJob();
                hj.jobordernumber  = Request.Form["data[123][job_order_no]"].FirstOrDefault();
                hj.lastname        = Request.Form["data[123][emp_ln_hang]"].FirstOrDefault();
                hj.sequence_number = Request.Form["data[123][sequence_no]"].FirstOrDefault();
                hj.part_number     = Request.Form["data[123][part_no]"].FirstOrDefault();
                hj.nmr_number      = Request.Form["data[123][nmr_no]"].FirstOrDefault();
                hj.paint_color     = Request.Form["data[123][paint_color]"].FirstOrDefault();
                hj.value_stream    = Request.Form["data[123][value_stream_id]"].FirstOrDefault();
                hj.qty_hung        = "1";

                string query = String.Empty;
                query  = "UPDATE paint_tracker SET ";
                query += "job_order_no = '" + NJS_Helper.FormatStringforDB(hj.jobordernumber) + "', ";
                query += "nmr_no = '" + NJS_Helper.FormatStringforDB(hj.nmr_number) + "', ";
                query += "sequence_no = '" + NJS_Helper.FormatStringforDB(hj.sequence_number) + "', ";
                query += "part_no = '" + NJS_Helper.FormatStringforDB(hj.part_number) + "', ";
                query += "value_stream_id = '" + NJS_Helper.FormatStringforDB(hj.value_stream) + "', ";
                query += "paint_color = '" + App_Helper.GetPaintCode() + NJS_Helper.FormatStringforDB(hj.paint_color) + "', ";
                query += "qty_hung = " + NJS_Helper.FormatStringforDB(hj.qty_hung) + ", ";
                //if (reworkCB.Checked == true)
                //{
                //    query += "rework= 'Y' ";
                //}
                //else
                //{
                query += "rework= 'N' ";
                //}
                // query += "WHERE (auto_id = " + auto_id + ")";

                using (MySqlConnection con = new MySqlConnection(DB.connection_string))
                {
                    MySqlCommand cmd = new MySqlCommand(query, con);
                    cmd.Connection.Open();
                    int rows = cmd.ExecuteNonQuery();
                    cmd.Connection.Close();
                    // to be implemented to store data in tables

                    return(Json(new
                    {
                        data = "Not Implemented"
                    }));
                }
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    data = ex.Message
                }));
            }
        }
예제 #2
0
        public async Task <JsonResult> InsertHangJob(string trackerType)
        {
            try
            {
                HangJob hj = new HangJob();
                hj.jobordernumber  = Request.Form["data[0][job_order_no]"].FirstOrDefault();
                hj.lastname        = Request.Form["data[0][emp_ln_hang]"].FirstOrDefault();
                hj.sequence_number = Request.Form["data[0][sequence_no]"].FirstOrDefault();
                hj.part_number     = Request.Form["data[0][part_no]"].FirstOrDefault();
                hj.nmr_number      = Request.Form["data[0][nmr_no]"].FirstOrDefault();
                hj.paint_color     = Request.Form["data[0][paint_color]"].FirstOrDefault();
                hj.value_stream    = Request.Form["data[0][value_stream_id]"].FirstOrDefault();
                hj.qty_hung        = "1";


                string query = String.Empty;

                query  = "INSERT INTO paint_tracker (auto_id, emp_no_hang, job_order_no, nmr_no, sequence_no, ";
                query += "part_no, value_stream_id, paint_color, qty_hung, dt_hang, rework, from_app) VALUES (";
                query += "NULL, ";
                query += "" + hj.hangjob_id + ", ";
                query += "'" + NJS_Helper.FormatStringforDB(hj.jobordernumber) + "', ";
                query += "'" + NJS_Helper.FormatStringforDB(hj.nmr_number) + "', ";
                query += "'" + NJS_Helper.FormatStringforDB(hj.sequence_number) + "', ";
                query += "'" + NJS_Helper.FormatStringforDB(hj.part_number) + "', ";
                query += "'" + NJS_Helper.FormatStringforDB(hj.value_stream) + "', ";
                query += "'" + App_Helper.GetPaintCode() + NJS_Helper.FormatStringforDB(hj.paint_color) + "', ";
                query += "" + NJS_Helper.FormatStringforDB(hj.qty_hung) + ", ";
                query += "'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "', ";
                //if (reworkCB.Checked == true)
                //{
                //    query += "'Y' ";
                //}
                //else
                //{
                query += "'N' ";
                //}
                query += ", 'Paint " + trackerType + "'";
                query += ")";
                using (MySqlConnection con = new MySqlConnection(DB.connection_string))
                {
                    MySqlCommand myCommand = new MySqlCommand(query, con);
                    myCommand.Connection.Open();
                    myCommand.ExecuteNonQuery();
                    con.Close();
                }
                // to be implemented to store data in tables
                return(Json(new
                {
                    data = "Record Inserted"
                }));
            }
            catch (Exception ex)
            {
                string x = ex.Message;
                return(Json(new
                {
                    data = ex.Message
                }));
            }
        }