public void MakeRawDepartmentStockIn(Department department, DepartmentStockIn stockIn) { DataAccessLayer dalSubStock = new DataAccessLayer(Properties.Settings.Default.SubStockDB); DataAccessLayer dalSalePoint = new DataAccessLayer(Properties.Settings.Default.SalePointDB); try { DepartmentStockOut stockOut = new FastDepartmentStockOutMapper().Convert(stockIn); stockOut.DepartmentStockOutPK = new DepartmentStockOutPK(); // cheat for stock in back to substock stockOut.DepartmentStockOutPK.DepartmentId = stockIn.DepartmentStockInPK.DepartmentId; Department subStockDept = new Department { DepartmentId = stockIn.DepartmentStockInPK.DepartmentId }; DoStockOut(dalSalePoint, department, stockOut, false); DoStockIn(dalSubStock, subStockDept, stockIn, false); InformMessage(subStockDept.DepartmentId, DEPTTOSUB, false, subStockDept.DepartmentId + " lấy hàng từ " + department.DepartmentId + " thành công !"); } catch (Exception exception) { ServerUtility.Log(logger,exception.Message); ServerUtility.Log(logger,exception.StackTrace); InformMessage(stockIn.DepartmentStockInPK.DepartmentId,DEPTTOSUB,true,exception.Message); } }
public void NotifyNewDepartmentStockIn(Department department, DepartmentStockIn stockIn) { if (CurrentDepartment.Get().DepartmentId != department.DepartmentId) { return; } ((MainForm)GlobalCache.Instance().MainForm).ServiceStatus.Text = " Đang nhận thông tin ..."; DepartmentStockOut stockOut; // convert from stock out to stock in // call method to sync try { ClientUtility.Log(logger, department.DepartmentId + " tra hang ve " + stockIn.DepartmentStockInPK.DepartmentId); stockOut = new FastDepartmentStockOutMapper().Convert(stockIn); ClientUtility.Log(logger, department.DepartmentId + " xuat hang ..."); stockOut.ConfirmFlg = 0; DepartmentStockOutLogic.Add(stockOut); ClientUtility.Log(logger, " Hoan tat và phản hồi ... "); ((MainForm)GlobalCache.Instance().MainForm).ServiceStatus.Text = " Hoàn tất và phản hồi ..."; serverService.InformDepartmentStockInSuccess(department, stockIn,stockOut.DepartmentStockOutPK.StockOutId); ((MainForm)GlobalCache.Instance().MainForm).ServiceStatus.Text = " Hoàn tất ! "; ClientUtility.Log(logger, " Hoan tat tra " + stockOut.ToString()); } catch (Exception ex) { ClientUtility.Log(logger, ex.Message); try { serverService.InformDepartmentStockInSuccess(department, null,0); } catch (Exception exception) { ClientUtility.Log(logger,exception.Message); } } }