Example #1
0
        public override bool Save()
        {
            try
            {
                using (SqlConnection connection = DbControl.GetOpenConnection())
                {
                    SqlCommand command = connection.CreateCommand();
                    command.Parameters.Add(new SqlParameter("@ceid", System.Data.SqlDbType.VarChar)).Value     = CEID.ToString();
                    command.Parameters.Add(new SqlParameter("@cst_id", System.Data.SqlDbType.VarChar)).Value   = CSTID.ToString();
                    command.Parameters.Add(new SqlParameter("@lot_code", System.Data.SqlDbType.VarChar)).Value = LotCode.ToString();


                    command.Parameters.Add(new SqlParameter("@lot_id", System.Data.SqlDbType.VarChar)).Value = LotID == null ? "" : LotID;


                    command.Parameters.Add(new SqlParameter("@cst_size", System.Data.SqlDbType.VarChar)).Value  = CSTSize == null ? "" : CSTSize.ToString();
                    command.Parameters.Add(new SqlParameter("@eng_code", System.Data.SqlDbType.VarChar)).Value  = EngCode == null ? "" : EngCode;
                    command.Parameters.Add(new SqlParameter("@gls_thick", System.Data.SqlDbType.VarChar)).Value = GLSThick == null ? "" : GLSThick.ToString();


                    command.Parameters.Add(new SqlParameter("@host_msg", System.Data.SqlDbType.VarChar)).Value    = HostMsg == null ? "" : HostMsg;
                    command.Parameters.Add(new SqlParameter("@inline_code", System.Data.SqlDbType.VarChar)).Value = InLineCode.ToString() + "";

                    command.Parameters.Add(new SqlParameter("@inno", System.Data.SqlDbType.VarChar)).Value  = InNo.ToString();
                    command.Parameters.Add(new SqlParameter("@outno", System.Data.SqlDbType.VarChar)).Value = OutNo.ToString();

                    command.Parameters.Add(new SqlParameter("@keyid", System.Data.SqlDbType.VarChar)).Value       = KeyID == null ? "" : KeyID;
                    command.Parameters.Add(new SqlParameter("@lot_command", System.Data.SqlDbType.VarChar)).Value = LotCommand == null ? "" : LotCommand;

                    command.Parameters.Add(new SqlParameter("@lot_judge", System.Data.SqlDbType.VarChar)).Value       = LotJudge == null ? "" : LotJudge;
                    command.Parameters.Add(new SqlParameter("@lot_start_time", System.Data.SqlDbType.DateTime)).Value = LotStartTime.ToString("yyyy-MM-dd HH:mm:ss.fff");

                    command.Parameters.Add(new SqlParameter("@lot_state", System.Data.SqlDbType.VarChar)).Value = LotState.ToString();
                    command.Parameters.Add(new SqlParameter("@mode_code", System.Data.SqlDbType.VarChar)).Value = ModeCode == null ? "" : ModeCode;
                    command.Parameters.Add(new SqlParameter("@part_num", System.Data.SqlDbType.VarChar)).Value  = PartNum == null ? "" : PartNum;

                    command.Parameters.Add(new SqlParameter("@permit", System.Data.SqlDbType.VarChar)).Value = Permit.ToString();


                    command.Parameters.Add(new SqlParameter("@port_id", System.Data.SqlDbType.VarChar)).Value = PortID == null ? "" : PortID;

                    command.Parameters.Add(new SqlParameter("@prc_id", System.Data.SqlDbType.VarChar)).Value     = PrcID == null ? "" : PrcID;
                    command.Parameters.Add(new SqlParameter("@prod_type", System.Data.SqlDbType.VarChar)).Value  = ProdType == null ? "" : ProdType;
                    command.Parameters.Add(new SqlParameter("@rcp", System.Data.SqlDbType.VarChar)).Value        = RCP == null ? "" : RCP;
                    command.Parameters.Add(new SqlParameter("@slot_count", System.Data.SqlDbType.VarChar)).Value = SlotCount.ToString();



                    command.Parameters.Add(new SqlParameter("@download_time", System.Data.SqlDbType.DateTime)).Value = DownloadTime.ToString("yyyy-MM-dd HH:mm:ss.fff");

                    command.CommandText = "update lot_data set " +
                                          "ceid=@ceid, cst_id=@cst_id, cst_size=@cst_size, eng_code=@eng_code, gls_thick=@gls_thick, host_msg=@host_msg, inline_code=@inline_code, inno=@inno, " +
                                          "outno=@outno, keyid=@keyid, lot_command=@lot_command, lot_id=@lot_id, lot_judge=@lot_judge, lot_start_time=@lot_start_time, lot_state=@lot_state, mode_code=@mode_code, part_num=part_num, permit=@permit, " +
                                          "port_id=@port_id, prc_id=@prc_id, prod_type=@prod_type, rcp=@rcp, slot_count=@slot_count, download_time=@download_time " +
                                          "where lot_code=@lot_code";
                    command.Connection = connection;
                    command.ExecuteNonQuery();
                }
                return(true);
            }
            catch (SqlException ex)
            {
                CLogManager.Instance.Log(new CExceptionLogFormat(Catagory.Error, "EMP", ex));
            }

            return(false);
        }
Example #2
0
        public override bool Add()
        {
            SqlDataReader reader = null;

            try
            {
                using (SqlConnection connection = DbControl.GetOpenConnection())
                {
                    SqlCommand readCommand = connection.CreateCommand();

                    readCommand.Parameters.Add(new SqlParameter("@lot_code", System.Data.SqlDbType.VarChar)).Value = LotCode.ToString();
                    readCommand.CommandText = "select * from lot_data where lot_code=@lot_code";
                    readCommand.Connection  = connection;
                    reader = readCommand.ExecuteReader();

                    if (reader.Read())
                    {
                        reader.Close();
                    }
                    else
                    {
                        reader.Close();

                        SqlCommand command = connection.CreateCommand();

                        //신규
                        command.Parameters.Add(new SqlParameter("@ceid", System.Data.SqlDbType.VarChar)).Value     = CEID.ToString();
                        command.Parameters.Add(new SqlParameter("@cst_id", System.Data.SqlDbType.VarChar)).Value   = CSTID.ToString() + "";
                        command.Parameters.Add(new SqlParameter("@lot_code", System.Data.SqlDbType.VarChar)).Value = LotCode.ToString();


                        command.Parameters.Add(new SqlParameter("@lot_id", System.Data.SqlDbType.VarChar)).Value = LotID == null ? "" : LotID;


                        command.Parameters.Add(new SqlParameter("@cst_size", System.Data.SqlDbType.VarChar)).Value  = CSTSize == null ? "" : CSTSize.ToString();
                        command.Parameters.Add(new SqlParameter("@eng_code", System.Data.SqlDbType.VarChar)).Value  = EngCode == null ? "" : EngCode;
                        command.Parameters.Add(new SqlParameter("@gls_thick", System.Data.SqlDbType.VarChar)).Value = GLSThick == null ? "" : GLSThick.ToString();


                        command.Parameters.Add(new SqlParameter("@host_msg", System.Data.SqlDbType.VarChar)).Value    = HostMsg == null ? "" : HostMsg;
                        command.Parameters.Add(new SqlParameter("@inline_code", System.Data.SqlDbType.VarChar)).Value = InLineCode.ToString() + "";

                        command.Parameters.Add(new SqlParameter("@inno", System.Data.SqlDbType.VarChar)).Value  = InNo.ToString();
                        command.Parameters.Add(new SqlParameter("@outno", System.Data.SqlDbType.VarChar)).Value = OutNo.ToString();

                        command.Parameters.Add(new SqlParameter("@keyid", System.Data.SqlDbType.VarChar)).Value       = KeyID == null ? "" : KeyID;
                        command.Parameters.Add(new SqlParameter("@lot_command", System.Data.SqlDbType.VarChar)).Value = LotCommand == null ? "" : LotCommand;

                        command.Parameters.Add(new SqlParameter("@lot_judge", System.Data.SqlDbType.VarChar)).Value       = LotJudge == null ? "" : LotJudge;
                        command.Parameters.Add(new SqlParameter("@lot_start_time", System.Data.SqlDbType.DateTime)).Value = LotStartTime.ToString("yyyy-MM-dd HH:mm:ss.fff");

                        command.Parameters.Add(new SqlParameter("@lot_state", System.Data.SqlDbType.VarChar)).Value = LotState.ToString();
                        command.Parameters.Add(new SqlParameter("@mode_code", System.Data.SqlDbType.VarChar)).Value = ModeCode == null ? "" : ModeCode;
                        command.Parameters.Add(new SqlParameter("@part_num", System.Data.SqlDbType.VarChar)).Value  = PartNum == null ? "" : PartNum;

                        command.Parameters.Add(new SqlParameter("@permit", System.Data.SqlDbType.VarChar)).Value = Permit.ToString();


                        command.Parameters.Add(new SqlParameter("@port_id", System.Data.SqlDbType.VarChar)).Value = PortID == null ? "" : PortID;

                        command.Parameters.Add(new SqlParameter("@prc_id", System.Data.SqlDbType.VarChar)).Value     = PrcID == null ? "" : PrcID;
                        command.Parameters.Add(new SqlParameter("@prod_type", System.Data.SqlDbType.VarChar)).Value  = ProdType == null ? "" : ProdType;
                        command.Parameters.Add(new SqlParameter("@rcp", System.Data.SqlDbType.VarChar)).Value        = RCP == null ? "" : RCP;
                        command.Parameters.Add(new SqlParameter("@slot_count", System.Data.SqlDbType.VarChar)).Value = SlotCount.ToString();



                        command.Parameters.Add(new SqlParameter("@download_time", System.Data.SqlDbType.DateTime)).Value = DownloadTime.ToString("yyyy-MM-dd HH:mm:ss.fff");


                        command.Connection = connection;

                        command.CommandText = "insert into lot_data " +
                                              "(lot_code, ceid, cst_id, cst_size, eng_code, gls_thick, host_msg, inline_code, inno, outno, keyid, lot_command, lot_id, lot_judge, lot_state, mode_code, part_num, permit, port_id, prc_id, prod_type, rcp, slot_count, download_time) " +
                                              "values (@lot_code, @ceid, @cst_id, @cst_size, @eng_code, @gls_thick, @host_msg, @inline_code, @inno, @outno, @keyid, @lot_command, @lot_id, @lot_judge, @lot_state, @mode_code, @part_num, @permit, @port_id, @prc_id, @prod_type, @rcp, @slot_count, @download_time)";
                        command.ExecuteNonQuery();

                        return(true);
                    }
                }
            }
            catch (SqlException ex)
            {
                CLogManager.Instance.Log(new CExceptionLogFormat(Catagory.Error, "EMP", ex));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
            return(false);
        }