public MachineShiftStting() { InitializeComponent(); this.m_codeMasterBLL = new CodeMasterBL(); this.m_machineShiftSettingBLL = new MachineShiftSttingBLL(); this.m_allMachineList = new List<MachineMaster_mmt_Info>(); this.m_allShiftTypeList = new List<ShiftTypeMaster_stm_Info>(); this.m_allShiftTypeGroupList = new List<ShiftTypeGroup_stg_Info>(); this.m_selectedGroupID = Guid.Empty; this.m_selectedMachineChange = false; }
bool ISync.Download(string machineID) { try { ShowMessage("同步字碼主檔..."); IList<CodeMaster_cmt_Info> sourceList; CodeMasterBL cmbl = new CodeMasterBL(); //if (!cmbl.CheckNeedUpdate()) //{ // ShowMessage("字碼主檔不需要更新。"); // return true; //} //加載SERVER字碼主檔 using (DBContext uow = new DBContext(NHConfigFactory.DBConfig.HBIMSN)) { var query = uow.CurrentSession.QueryOver<CodeMaster_cmt_Info>(); sourceList = query.List<CodeMaster_cmt_Info>(); } using (DBContext uow = DBContext.Begin(NHConfigFactory.DBConfig.PPC)) { //刪除LOCAL字碼主檔 uow.CurrentSession.CreateQuery("delete from CodeMaster_cmt_Info").ExecuteUpdate(); uow.CurrentSession.SessionFactory.Evict(typeof(CodeMaster_cmt_Info)); //保存SERVER字碼主檔到LOCAL foreach (var item in sourceList) { uow.CurrentSession.Save(item); } uow.CurrentSession.Flush(); } return true; } catch (Exception ex) { Common.General.BLLoger.Error(ex); return false; //throw ex; } }