public void DeleteDepartment(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { OleExec sfcdb = null; string DeleteSql = ""; string StrID = ""; T_C_DEPARTMENT department; // string[] ID = Newtonsoft.Json.Linq.JArray(Data["ID"].); Newtonsoft.Json.Linq.JArray ID = (Newtonsoft.Json.Linq.JArray)Data["ID"]; try { sfcdb = this.DBPools["SFCDB"].Borrow(); sfcdb.BeginTrain(); department = new T_C_DEPARTMENT(sfcdb, DBTYPE); for (int i = 0; i < ID.Count; i++) { StrID = ID[i].ToString(); Row_C_DEPARTMENT row = (Row_C_DEPARTMENT)department.GetObjByID(StrID, sfcdb); DeleteSql = row.GetDeleteString(DBTYPE); sfcdb.ExecSQL(DeleteSql); } sfcdb.CommitTrain(); StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.MessageCode = "MES00000004"; this.DBPools["SFCDB"].Return(sfcdb); } catch (Exception e) { this.DBPools["SFCDB"].Return(sfcdb); throw e; } }
/// <summary> /// 更新標簽顯示語言數據 /// </summary> /// <param name="requestValue"></param> /// <param name="Data"></param> /// <param name="StationReturn"></param> public void UpdateDepartment(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { OleExec sfcdb = null; string UpdateSql = ""; T_C_DEPARTMENT department; string ID = Data["ID"].ToString().Trim(); string DepartmentName = Data["DepartmentName"].ToString().Trim(); string Desc = Data["Desc"].ToString().Trim(); double SeqNo = Convert.ToDouble(Data["SeqNo"]); try { sfcdb = this.DBPools["SFCDB"].Borrow(); department = new T_C_DEPARTMENT(sfcdb, DBTYPE); Row_C_DEPARTMENT row = (Row_C_DEPARTMENT)department.GetObjByID(ID, sfcdb); row.ID = ID; row.DEPARTMENT_NAME = DepartmentName; row.DESCRIPTION = Desc; row.SEQ_NO = SeqNo; row.DESCRIPTION = Desc; row.EDIT_EMP = LoginUser.EMP_NO; row.EDIT_TIME = GetDBDateTime(); UpdateSql = row.GetUpdateString(DBTYPE); sfcdb.ExecSQL(UpdateSql); StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.MessageCode = "MES00000003"; this.DBPools["SFCDB"].Return(sfcdb); } catch (Exception e) { this.DBPools["SFCDB"].Return(sfcdb); throw e; } }
public void AddDepartment(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn) { OleExec sfcdb = null; string InsertSql = ""; T_C_DEPARTMENT department; string DepartmentName = Data["DepartmentName"].ToString().Trim(); string Desc = Data["Desc"].ToString().Trim(); double SeqNo = Convert.ToDouble(Data["SeqNo"]); try { sfcdb = this.DBPools["SFCDB"].Borrow(); department = new T_C_DEPARTMENT(sfcdb, DBTYPE); if (department.CheckDataExist(DepartmentName, sfcdb)) { Row_C_DEPARTMENT row = (Row_C_DEPARTMENT)department.NewRow(); row.ID = department.GetNewID(BU, sfcdb); row.DEPARTMENT_NAME = DepartmentName; row.DESCRIPTION = Desc; row.SEQ_NO = SeqNo; row.EDIT_EMP = LoginUser.EMP_NO; row.EDIT_TIME = GetDBDateTime(); InsertSql = row.GetInsertString(DBTYPE); sfcdb.ExecSQL(InsertSql); StationReturn.Status = StationReturnStatusValue.Pass; StationReturn.MessageCode = "MES00000002"; this.DBPools["SFCDB"].Return(sfcdb); } else { StationReturn.Status = StationReturnStatusValue.Fail; StationReturn.MessageCode = "MES00000005"; } } catch (Exception e) { this.DBPools["SFCDB"].Return(sfcdb); throw e; } }