public bool Insert(MacBLL u)
        {
            bool          isSuccess = false;
            SqlConnection conn      = new SqlConnection(myconnstrng);

            try
            {
                String sql = @"INSERT INTO tbl_mac
                            (" + MacName + ","
                             + MacTon + ","
                             + MacLocation + ","
                             + MacLotNo + ","
                             + MacAddedBy + ","
                             + MacAddedDate + ") VALUES" +
                             "(@mac_name," +
                             "@mac_ton," +
                             "@mac_location," +
                             "@mac_lot_no," +
                             "@mac_added_by," +
                             "@mac_added_date)";

                SqlCommand cmd = new SqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@mac_name", u.mac_name);
                cmd.Parameters.AddWithValue("@mac_ton", u.mac_ton);
                cmd.Parameters.AddWithValue("@mac_location", u.mac_location);
                cmd.Parameters.AddWithValue("@mac_lot_no", u.mac_lot_no);
                cmd.Parameters.AddWithValue("@mac_added_by", u.mac_added_by);
                cmd.Parameters.AddWithValue("@mac_added_date", u.mac_added_date);

                conn.Open();

                int rows = cmd.ExecuteNonQuery();

                //if the query is executed successfully then the rows' value = 0
                if (rows > 0)
                {
                    //query successful
                    isSuccess = true;
                }
                else
                {
                    //Query falled
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                Module.Tool tool = new Module.Tool(); tool.saveToTextAndMessageToUser(ex);
            }
            finally
            {
                conn.Close();
            }

            return(isSuccess);
        }
Ejemplo n.º 2
0
        public bool InsertProductionPackaging(ProductionRecordBLL u)
        {
            bool          isSuccess = false;
            SqlConnection conn      = new SqlConnection(myconnstrng);

            try
            {
                String sql = @"INSERT INTO tbl_pro_packaging
                            (" + SheetID + ","
                             + PackagingCode + ","
                             + PackagingQty + ","
                             + PackagingMax + ","
                             + UpdatedDate + ","
                             + UpdatedBy + ") VALUES" +
                             "(@sheet_id," +
                             "@packaging_code," +
                             "@packaging_qty," +
                             "@packaging_max," +
                             "@updated_date," +
                             "@updated_by)";

                SqlCommand cmd = new SqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@sheet_id", u.sheet_id);
                cmd.Parameters.AddWithValue("@packaging_code", u.packaging_code);
                cmd.Parameters.AddWithValue("@packaging_qty", u.packaging_qty);
                cmd.Parameters.AddWithValue("@packaging_max", u.packaging_max);
                cmd.Parameters.AddWithValue("@updated_date", u.updated_date);
                cmd.Parameters.AddWithValue("@updated_by", u.updated_by);

                conn.Open();

                int rows = cmd.ExecuteNonQuery();

                //if the query is executed successfully then the rows' value = 0
                if (rows > 0)
                {
                    //query successful
                    isSuccess = true;
                }
                else
                {
                    //Query falled
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                Module.Tool tool = new Module.Tool(); tool.saveToTextAndMessageToUser(ex);
            }
            finally
            {
                conn.Close();
            }
            return(isSuccess);
        }
        public bool Insert(habitBLL u)
        {
            bool          isSuccess = false;
            SqlConnection conn      = new SqlConnection(myconnstrng);

            try
            {
                String sql = @"INSERT INTO tbl_habit 
                            (" + BelongTo + ","
                             + HabitName + ","
                             + HabitData + ","
                             + AddedDate + ","
                             + AddedBy + ") VALUES" +
                             "(@belong_to," +
                             "@habit_name," +
                             "@habit_data," +
                             "@added_date," +
                             "@added_by)";

                SqlCommand cmd = new SqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@belong_to", u.belong_to);
                cmd.Parameters.AddWithValue("@habit_name", u.habit_name);
                cmd.Parameters.AddWithValue("@habit_data", u.habit_data);
                cmd.Parameters.AddWithValue("@added_date", u.added_date);
                cmd.Parameters.AddWithValue("@added_by", u.added_by);

                conn.Open();

                int rows = cmd.ExecuteNonQuery();

                //if the query is executed successfully then the rows' value = 0
                if (rows > 0)
                {
                    //query successful
                    isSuccess = true;
                }
                else
                {
                    //Query falled
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                Module.Tool tool = new Module.Tool(); tool.saveToTextAndMessageToUser(ex);
            }
            finally
            {
                conn.Close();
            }
            return(isSuccess);
        }
Ejemplo n.º 4
0
        public bool InsertSheetMeter(ProductionRecordBLL u)
        {
            bool          isSuccess = false;
            SqlConnection conn      = new SqlConnection(myconnstrng);

            try
            {
                String sql = @"INSERT INTO tbl_production_meter_reading
                            (" + SheetID + ","
                             + ProTime + ","
                             + ProOperator + ","
                             + ProMeterReading + ") VALUES" +
                             "(@sheet_id," +
                             "@time," +
                             "@production_operator," +
                             "@meter_reading)";

                SqlCommand cmd = new SqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@sheet_id", u.sheet_id);
                cmd.Parameters.AddWithValue("@time", u.time);
                cmd.Parameters.AddWithValue("@production_operator", u.production_operator);
                cmd.Parameters.AddWithValue("@meter_reading", u.meter_reading);

                conn.Open();

                int rows = cmd.ExecuteNonQuery();

                //if the query is executed successfully then the rows' value = 0
                if (rows > 0)
                {
                    //query successful
                    isSuccess = true;
                }
                else
                {
                    //Query falled
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                Module.Tool tool = new Module.Tool(); tool.saveToTextAndMessageToUser(ex);
            }
            finally
            {
                conn.Close();
            }
            return(isSuccess);
        }
        public bool Insert(pmmaDateBLL u)
        {
            bool          isSuccess = false;
            SqlConnection conn      = new SqlConnection(myconnstrng);

            try
            {
                String sql = @"INSERT INTO tbl_pmma_date 
                            (" + dateMonth + "," + dateYear + "," + dateStart + "," + dateEnd + "," + dateUpdatedDate + "," + dateUpdatedBy + ") VALUES (@month,@year," +
                             "@date_start," +
                             "@date_end," +
                             "@updated_date," +
                             "@updated_by)";

                SqlCommand cmd = new SqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@month", u.month);
                cmd.Parameters.AddWithValue("@year", u.year);
                cmd.Parameters.AddWithValue("@date_start", u.date_start);
                cmd.Parameters.AddWithValue("@date_end", u.date_end);
                cmd.Parameters.AddWithValue("@updated_date", u.updated_date);
                cmd.Parameters.AddWithValue("@updated_by", u.updated_by);


                conn.Open();

                int rows = cmd.ExecuteNonQuery();

                //if the query is executed successfully then the rows' value = 0
                if (rows > 0)
                {
                    //query successful
                    isSuccess = true;
                }
                else
                {
                    //Query falled
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                Module.Tool tool = new Module.Tool(); tool.saveToTextAndMessageToUser(ex);
            }
            finally
            {
                conn.Close();
            }
            return(isSuccess);
        }
Ejemplo n.º 6
0
        public bool InsertProductionRecord(ProductionRecordBLL u)
        {
            bool isSuccess = false;

            u.active = true;
            SqlConnection conn = new SqlConnection(myconnstrng);

            try
            {
                String sql = @"INSERT INTO tbl_production_record 
                            (" + PlanID + ","
                             + ProDate + ","
                             + Shift + ","
                             + ProLotNo + ","
                             + RawMatLotNo + ","
                             + ColorMatLotNo + ","
                             + MeterStart + ","
                             + MeterEnd + ","
                             + LastShiftBalance + ","
                             + CurrentShiftBalance + ","
                             + FullBox + ","
                             + TotalProduced + ","
                             + TotalReject + ","
                             + UpdatedDate + ","
                             + UpdatedBy + ","
                             + Active + ","
                             + PackagingQty + ","
                             + PackagingCode + ","
                             + directIn + ","
                             + directOut + ","
                             + ParentCode + ","
                             + Note + ") VALUES" +
                             "(@plan_id," +
                             "@production_date," +
                             "@shift," +
                             "@production_lot_no," +
                             "@raw_mat_lot_no," +
                             "@color_mat_lot_no," +
                             "@meter_start," +
                             "@meter_end," +
                             "@last_shift_balance," +
                             "@current_shift_balance," +
                             "@full_box," +
                             "@total_produced," +
                             "@total_reject," +
                             "@updated_date," +
                             "@updated_by," +
                             "@active," +
                             "@packaging_qty," +
                             "@packaging_code," +
                             "@directIn," +
                             "@directOut," +
                             "@parent_code," +
                             "@note)";

                SqlCommand cmd = new SqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@plan_id", u.plan_id);
                cmd.Parameters.AddWithValue("@production_date", u.production_date);
                cmd.Parameters.AddWithValue("@shift", u.shift);
                cmd.Parameters.AddWithValue("@production_lot_no", u.production_lot_no);
                cmd.Parameters.AddWithValue("@raw_mat_lot_no", u.raw_mat_lot_no);
                cmd.Parameters.AddWithValue("@color_mat_lot_no", u.color_mat_lot_no);
                cmd.Parameters.AddWithValue("@meter_start", u.meter_start);
                cmd.Parameters.AddWithValue("@meter_end", u.meter_end);
                cmd.Parameters.AddWithValue("@last_shift_balance", u.last_shift_balance);
                cmd.Parameters.AddWithValue("@current_shift_balance", u.current_shift_balance);
                cmd.Parameters.AddWithValue("@full_box", u.full_box);
                cmd.Parameters.AddWithValue("@total_produced", u.total_produced);
                cmd.Parameters.AddWithValue("@total_reject", u.total_reject);
                cmd.Parameters.AddWithValue("@updated_date", u.updated_date);
                cmd.Parameters.AddWithValue("@updated_by", u.updated_by);
                cmd.Parameters.AddWithValue("@active", u.active);
                cmd.Parameters.AddWithValue("@packaging_code", u.packaging_code);
                cmd.Parameters.AddWithValue("@packaging_qty", u.packaging_qty);
                cmd.Parameters.AddWithValue("@parent_code", u.parent_code);
                cmd.Parameters.AddWithValue("@note", u.note);
                cmd.Parameters.AddWithValue("@directIn", u.directIn);
                cmd.Parameters.AddWithValue("@directOut", u.directOut);

                conn.Open();

                int rows = cmd.ExecuteNonQuery();

                //if the query is executed successfully then the rows' value = 0
                if (rows > 0)
                {
                    //query successful
                    isSuccess = true;
                }
                else
                {
                    //Query falled
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                Module.Tool tool = new Module.Tool(); tool.saveToTextAndMessageToUser(ex);
            }
            finally
            {
                conn.Close();
            }
            return(isSuccess);
        }
        public bool Insert(PlanningBLL u)
        {
            bool          isSuccess = false;
            SqlConnection conn      = new SqlConnection(myconnstrng);

            try
            {
                String sql = @"INSERT INTO tbl_plan 
                            (" + planAddedDate + ","
                             + planAddedBy + ","
                             + planStatus + ","
                             + planNote + ","
                             + planCT + ","
                             + planPW + ","
                             + planRW + ","
                             + planCavity + ","
                             + partCode + ","
                             + productionPurpose + ","
                             + materialCode + ","
                             + materialBagQty + ","
                             + materialRecycleUse + ","
                             + colorMaterialCode + ","
                             + colorMaterialUsage + ","
                             + colorMaterialQty + ","
                             + targetQty + ","
                             + ableQty + ","
                             + productionDay + ","
                             + productionHour + ","
                             + productionHourPerDay + ","
                             + productionStartDate + ","
                             + productionEndDate + ","
                             + machineID + ","
                             + familyWith + ") VALUES" +
                             "(@plan_added_date," +
                             "@plan_added_by," +
                             "@plan_status," +
                             "@plan_note," +
                             "@plan_ct," +
                             "@plan_pw," +
                             "@plan_rw," +
                             "@plan_cavity," +
                             "@part_code," +
                             "@production_purpose," +
                             "@material_code," +
                             "@material_bag_qty," +
                             "@material_recycle_use," +
                             "@color_material_code," +
                             "@color_material_usage," +
                             "@color_material_qty," +
                             "@production_target_qty," +
                             "@production_able_produce_qty," +
                             "@production_day," +
                             "@production_hour," +
                             "@production_hour_per_day," +
                             "@production_start_date," +
                             "@production_end_date," +
                             "@machine_id," +
                             "@family_with)";

                SqlCommand cmd = new SqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@plan_added_date", u.plan_added_date);
                cmd.Parameters.AddWithValue("@plan_added_by", u.plan_added_by);
                cmd.Parameters.AddWithValue("@plan_status", u.plan_status);
                cmd.Parameters.AddWithValue("@plan_note", u.plan_note);
                cmd.Parameters.AddWithValue("@plan_ct", u.plan_ct);
                cmd.Parameters.AddWithValue("@plan_pw", u.plan_pw);
                cmd.Parameters.AddWithValue("@plan_rw", u.plan_rw);
                cmd.Parameters.AddWithValue("@plan_cavity", u.plan_cavity);
                cmd.Parameters.AddWithValue("@part_code", u.part_code);
                cmd.Parameters.AddWithValue("@production_purpose", u.production_purpose);
                cmd.Parameters.AddWithValue("@material_code", u.material_code);
                cmd.Parameters.AddWithValue("@material_bag_qty", u.material_bag_qty);
                cmd.Parameters.AddWithValue("@material_recycle_use", u.material_recycle_use);
                cmd.Parameters.AddWithValue("@color_material_code", u.color_material_code);
                cmd.Parameters.AddWithValue("@color_material_usage", u.color_material_usage);
                cmd.Parameters.AddWithValue("@color_material_qty", u.color_material_qty);
                cmd.Parameters.AddWithValue("@production_target_qty", u.production_target_qty);
                cmd.Parameters.AddWithValue("@production_able_produce_qty", u.production_able_produce_qty);
                cmd.Parameters.AddWithValue("@production_day", u.production_day);
                cmd.Parameters.AddWithValue("@production_hour", u.production_hour);
                cmd.Parameters.AddWithValue("@production_hour_per_day", u.production_hour_per_day);
                cmd.Parameters.AddWithValue("@production_start_date", u.production_start_date);
                cmd.Parameters.AddWithValue("@production_end_date", u.production_end_date);
                cmd.Parameters.AddWithValue("@machine_id", u.machine_id);
                cmd.Parameters.AddWithValue("@family_with", u.family_with);

                conn.Open();

                int rows = cmd.ExecuteNonQuery();

                //if the query is executed successfully then the rows' value = 0
                if (rows > 0)
                {
                    //query successful
                    isSuccess = true;
                }
                else
                {
                    //Query falled
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                Module.Tool tool = new Module.Tool(); tool.saveToTextAndMessageToUser(ex);
            }
            finally
            {
                conn.Close();
            }
            return(isSuccess);
        }
Ejemplo n.º 8
0
        public bool Insert(matPlanBLL u)
        {
            bool          isSuccess = false;
            SqlConnection conn      = new SqlConnection(myconnstrng);

            try
            {
                String sql = @"INSERT INTO tbl_matplan 
                            (" + MatCode + ","
                             + PlanID + ","
                             + PlanToUse + ","
                             + MatUsed + ","
                             + Active + ","
                             + MatNote + ","
                             + UpdatedDate + ","
                             + UpdatedBy + ") VALUES" +
                             "(@mat_code,@plan_id," +
                             "@plan_to_use," +
                             "@mat_used," +
                             "@active," +
                             "@mat_note," +
                             "@updated_date," +
                             "@updated_by)";

                SqlCommand cmd = new SqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@mat_code", u.mat_code);
                cmd.Parameters.AddWithValue("@plan_id", u.plan_id);
                cmd.Parameters.AddWithValue("@plan_to_use", u.plan_to_use);
                cmd.Parameters.AddWithValue("@mat_used", u.mat_used);
                cmd.Parameters.AddWithValue("@active", u.active);
                cmd.Parameters.AddWithValue("@mat_note", u.mat_note);
                cmd.Parameters.AddWithValue("@updated_date", u.updated_date);
                cmd.Parameters.AddWithValue("@updated_by", u.updated_by);

                conn.Open();

                int rows = cmd.ExecuteNonQuery();

                //if the query is executed successfully then the rows' value = 0
                if (rows > 0)
                {
                    //query successful
                    isSuccess = true;
                }
                else
                {
                    //Query falled
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                Module.Tool tool = new Module.Tool(); tool.saveToTextAndMessageToUser(ex);
            }
            finally
            {
                conn.Close();
            }
            return(isSuccess);
        }