Example #1
0
        public void DeleteSectionByID(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            OleExec sfcdb = null;

            try
            {
                sfcdb = this.DBPools["SFCDB"].Borrow();
                T_C_SECTION   cSection = new T_C_SECTION(sfcdb, DB_TYPE_ENUM.Oracle);
                Row_C_SECTION r        = (Row_C_SECTION)cSection.GetObjByID(Data["ID"].ToString(), sfcdb, DB_TYPE_ENUM.Oracle);
                string        strRet   = sfcdb.ExecSQL(r.GetDeleteString(DB_TYPE_ENUM.Oracle));
                if (Convert.ToInt32(strRet) > 0)
                {
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000004";
                    StationReturn.Data        = "";
                }
                else
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "NotLatestData";
                }
                this.DBPools["SFCDB"].Return(sfcdb);
            }
            catch (Exception e)
            {
                this.DBPools["SFCDB"].Return(sfcdb);
                throw e;
            }
        }
        public void DeleteSectionByID(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            OleExec sfcdb = this.DBPools["SFCDB"].Borrow();

            try
            {
                T_C_SECTION   cSection = new T_C_SECTION(sfcdb, DB_TYPE_ENUM.Oracle);
                Row_C_SECTION r        = (Row_C_SECTION)cSection.GetObjByID(Data["ID"].ToString(), sfcdb, DB_TYPE_ENUM.Oracle);
                string        strRet   = sfcdb.ExecSQL(r.GetDeleteString(DB_TYPE_ENUM.Oracle));
                if (Convert.ToInt32(strRet) > 0)
                {
                    StationReturn.Status  = StationReturnStatusValue.Pass;
                    StationReturn.Message = "OK";
                    StationReturn.Data    = strRet;
                }
                else
                {
                    StationReturn.Status  = StationReturnStatusValue.Fail;
                    StationReturn.Message = "Delete Fail or Data Not Exist";
                }
            }
            catch (Exception e)
            {
                StationReturn.Message = e.Message;
                StationReturn.Status  = StationReturnStatusValue.Fail;
            }
            finally
            {
                this.DBPools["SFCDB"].Return(sfcdb);
            }
        }