Esempio n. 1
0
        public void DeleteBU(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            string   id    = Data["BU_ID"].ToString().Trim();
            OleExec  oleDB = null;
            T_C_BU   bu    = null;
            Row_C_BU rowBU = null;

            if (string.IsNullOrEmpty(id))
            {
                StationReturn.Status      = StationReturnStatusValue.Fail;
                StationReturn.MessageCode = "MES00000006";
                StationReturn.MessagePara.Add("BU ID");
                StationReturn.Data = "";
                return;
            }
            try
            {
                oleDB = this.DBPools["SFCDB"].Borrow();
                bu    = new T_C_BU(oleDB, DBTYPE);
                oleDB.ThrowSqlExeception = true;
                rowBU = (Row_C_BU)bu.GetObjByID(id, oleDB, DBTYPE);
                oleDB.ExecSQL(rowBU.GetDeleteString(DBTYPE));
                StationReturn.Status      = StationReturnStatusValue.Pass;
                StationReturn.MessageCode = "MES00000004";
                this.DBPools["SFCDB"].Return(oleDB);
            }
            catch (Exception exception)
            {
                this.DBPools["SFCDB"].Return(oleDB);
                throw exception;
            }
        }
Esempio n. 2
0
        public void AddNewBU(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            string   strbu = Data["BU"].ToString().Trim();
            OleExec  oleDB = null;
            T_C_BU   bu    = null;
            Row_C_BU buRow = null;

            try
            {
                oleDB = this.DBPools["SFCDB"].Borrow();
                bu    = new T_C_BU(oleDB, DBTYPE);
                if (bu.BUIsExist(oleDB, strbu))
                {
                    StationReturn.Status      = StationReturnStatusValue.Fail;
                    StationReturn.MessageCode = "MES00000005";
                    StationReturn.Data        = "";
                }
                else
                {
                    buRow    = (Row_C_BU)bu.NewRow();
                    buRow.ID = bu.GetNewID(SystemName, oleDB, DBTYPE);
                    buRow.BU = strbu;
                    oleDB.ThrowSqlExeception = true;
                    oleDB.ExecSQL(buRow.GetInsertString(DBTYPE));
                    StationReturn.Status      = StationReturnStatusValue.Pass;
                    StationReturn.MessageCode = "MES00000002";
                    StationReturn.Data        = "";
                }
                this.DBPools["SFCDB"].Return(oleDB);
            }
            catch (Exception exception)
            {
                this.DBPools["SFCDB"].Return(oleDB);
                throw exception;
            }
        }