public DataTable SelectWithKeys(Database database, NZString key1, NZString key2, NZString key3, NZString key4, NZString key5) { Database db = UseDatabase(database); string sql = @" SELECT * FROM TZ_TRANS_LOCK WHERE (KEY1 = :KEY1) AND (KEY2 = :KEY2) AND (KEY3 = :KEY3) AND (KEY4 = :KEY4) AND (KEY5 = :KEY5)"; DataRequest req = new DataRequest(sql); req.Parameters.Add("KEY1", DataType.VarChar, key1.StrongValue); req.Parameters.Add("KEY2", DataType.VarChar, key2.StrongValue); req.Parameters.Add("KEY3", DataType.VarChar, key3.StrongValue); req.Parameters.Add("KEY4", DataType.VarChar, key4.StrongValue); req.Parameters.Add("KEY5", DataType.VarChar, key5.StrongValue); return(db.ExecuteQuery(req)); }
public SalesUnitPriceDTO LoadSalesUnitPriceByPK(Database database, NZString ITEM_CD, NZDateTime START_EFFECTIVE_DATE, NZString CURRENCY) { Database db = UseDatabase(database); DataRequest req = new DataRequest("S_MAS120_LoadSalesUnitPriceByPK"); req.CommandType = CommandType.StoredProcedure; req.Parameters.Add("@pVar_ItemCD", DataType.NVarChar, ITEM_CD.Value); req.Parameters.Add("@pDtm_StartEffectiveDate", DataType.DateTime, ((DateTime)START_EFFECTIVE_DATE.Value).Date); req.Parameters.Add("@pVar_Currency", DataType.NVarChar, CURRENCY.Value); List <SalesUnitPriceDTO> list = db.ExecuteForList <SalesUnitPriceDTO>(req); if (list != null && list.Count > 0) { return(list[0]); } return(null); }
/// <summary> /// Load data for Receiving Entry. /// </summary> /// <param name="receiveNo"></param> /// <returns></returns> public ReceivingEntryUIDM LoadData(NZString receiveNo) { InventoryBIZ biz = new InventoryBIZ(); List <InventoryTransactionViewDTO> listViewDTO = biz.LoadTransactionViewByReceiveNo(receiveNo); if (listViewDTO != null) { if (listViewDTO.Count > 0) { ReceivingEntryUIDM model = MapDTOToUIDM(listViewDTO[0]); model.DATA_VIEW = DTOUtility.ConvertListToDataTable(listViewDTO); //== Ensure that data has not modified. model.DATA_VIEW.AcceptChanges(); return(model); } } return(new ReceivingEntryUIDM()); }
/// <summary> /// Check if Transaction can edit or delete? /// </summary> /// <param name="transactionID"></param> /// <returns></returns> public bool TransactionCanEditOrDelete(NZString transactionID) { InventoryTransBIZ bizInventoryTrans = new InventoryTransBIZ(); InventoryTransactionDTO dtoInventoryTransaction = bizInventoryTrans.LoadByTransactionID(transactionID); if (dtoInventoryTransaction == null) { return(false); } ErrorItem err = DateIsInCurrentPeriod(dtoInventoryTransaction.TRANS_DATE.StrongValue); if (err == null) { return(true); } return(false); }
/// <summary> /// Delete record with key. /// </summary> /// <param name="database"></param> /// <param name="YEAR_MONTH">Key #1</param> /// <returns></returns> public int Delete(Database database, NZString YEAR_MONTH) { Database db = UseDatabase(database); StringBuilder sb = new StringBuilder(); #region SQL Statement string tableName = EVOFramework.Data.DTOUtility.ReadTableName(typeof(InventoryPeriodDTO)); sb.AppendLine(" DELETE FROM " + tableName); sb.AppendLine(" WHERE "); sb.AppendLine(" " + InventoryPeriodDTO.eColumns.YEAR_MONTH + "=:YEAR_MONTH"); #endregion DataRequest req = new DataRequest(sb.ToString()); #region Parameters req.Parameters.Add("YEAR_MONTH", DataType.NVarChar, YEAR_MONTH.Value); #endregion return(db.ExecuteNonQuery(req)); }
/// <summary> /// Delete record with key. /// </summary> /// <param name="database"></param> /// <param name="PROCESS_NO">Key #1</param> /// <returns></returns> public int Delete(Database database, NZString PROCESS_NO) { Database db = UseDatabase(database); StringBuilder sb = new StringBuilder(); #region SQL Statement string tableName = EVOFramework.Data.DTOUtility.ReadTableName(typeof(ProcessDTO)); sb.AppendLine(" DELETE FROM " + tableName); sb.AppendLine(" WHERE "); sb.AppendLine(" " + ProcessDTO.eColumns.PROCESS_NO + "=:PROCESS_NO"); #endregion DataRequest req = new DataRequest(sb.ToString()); #region Parameters req.Parameters.Add("PROCESS_NO", DataType.NVarChar, PROCESS_NO.Value); #endregion return(db.ExecuteNonQuery(req)); }
/// <summary> /// Delete record with key. /// </summary> /// <param name="database"></param> /// <param name="ITEM_CD">Key #1</param> /// <returns></returns> public int Delete(Database database, NZString ITEM_CD) { Database db = UseDatabase(database); StringBuilder sb = new StringBuilder(); #region SQL Statement string tableName = EVOFramework.Data.DTOUtility.ReadTableName(typeof(ItemImageDTO)); sb.AppendLine(" DELETE FROM " + tableName); sb.AppendLine(" WHERE "); sb.AppendLine(" " + ItemImageDTO.eColumns.ITEM_CD + "=:ITEM_CD"); #endregion DataRequest req = new DataRequest(sb.ToString()); #region Parameters req.Parameters.Add("ITEM_CD", DataType.NVarChar, ITEM_CD.Value); #endregion return(db.ExecuteNonQuery(req)); }
/// <summary> /// Load with specified primary key. /// </summary> /// <param name="database"></param> /// <param name="SCREEN_CD">Key #1</param> /// <returns></returns> public ScreenDTO LoadByPK(Database database, NZString SCREEN_CD) { Database db = UseDatabase(database); StringBuilder sb = new StringBuilder(); #region SQL Statement string tableName = EVOFramework.Data.DTOUtility.ReadTableName(typeof(ScreenDTO)); sb.AppendLine(" SELECT "); sb.AppendLine(" " + ScreenDTO.eColumns.SCREEN_CD); sb.AppendLine(" ," + ScreenDTO.eColumns.SCREEN_NAME); sb.AppendLine(" ," + ScreenDTO.eColumns.IMAGE_CD); sb.AppendLine(" ," + ScreenDTO.eColumns.SCREEN_TYPE); sb.AppendLine(" ," + ScreenDTO.eColumns.SCREEN_ACTION); sb.AppendLine(" ," + ScreenDTO.eColumns.EXT_PROGRAM); sb.AppendLine(" ," + ScreenDTO.eColumns.CRT_BY); sb.AppendLine(" ," + ScreenDTO.eColumns.CRT_DATE); sb.AppendLine(" ," + ScreenDTO.eColumns.CRT_MACHINE); sb.AppendLine(" ," + ScreenDTO.eColumns.UPD_BY); sb.AppendLine(" ," + ScreenDTO.eColumns.UPD_DATE); sb.AppendLine(" ," + ScreenDTO.eColumns.UPD_MACHINE); sb.AppendLine(" ," + ScreenDTO.eColumns.ORIGINAL_TITLE); sb.AppendLine(" FROM " + tableName); sb.AppendLine(" WHERE "); sb.AppendLine(" " + ScreenDTO.eColumns.SCREEN_CD + "=:SCREEN_CD"); #endregion DataRequest req = new DataRequest(sb.ToString()); #region Parameters req.Parameters.Add("SCREEN_CD", DataType.VarChar, SCREEN_CD.Value); #endregion List <ScreenDTO> list = db.ExecuteForList <ScreenDTO>(req); if (list != null && list.Count > 0) { return(list[0]); } return(null); }
private void OnDelete() { try { NZString OrderNo = new NZString(null, shtCustomerOrderList.GetValue(shtCustomerOrderList.ActiveRowIndex, (int)eColView.ORDER_NO)); NZString OrderDetailNo = new NZString(null, shtCustomerOrderList.GetValue(shtCustomerOrderList.ActiveRowIndex, (int)eColView.ORDER_DETAIL_NO)); MessageDialogResult dr = MessageDialog.ShowConfirmation(this, new Message(Messages.eConfirm.CFM9002.ToString()), MessageDialogButtons.YesNo); if (dr == MessageDialogResult.No) { return; } m_controller.DeleteItem(OrderNo, OrderDetailNo); // When detail row <= 0 then delete header row CustomerOrderBIZ biz = new CustomerOrderBIZ(); if (biz.LoadCustomerOrderEntry(OrderNo, false).Count <= 0) { biz.DeleteCustomerOrderHeader(Common.CurrentDatabase, OrderNo); } shtCustomerOrderList.RemoveRows(shtCustomerOrderList.ActiveRowIndex, 1); MessageDialog.ShowInformation(this, null, new Message(Messages.eInformation.INF9003.ToString()).MessageDescription); } catch (BusinessException err) { MessageDialog.ShowBusiness(this, err.Error.Message); err.Error.FocusOnControl(); } catch (ValidateException err) { MessageDialog.ShowBusiness(this, err.ErrorResults[0].Message); err.ErrorResults[0].FocusOnControl(); } catch (Exception err) { MessageDialog.ShowBusiness(this, err.Message); } }
private void DeleteBOM() { if (shtItemView.Rows.Count == 0) { return; } if (shtItemView.ActiveRowIndex < 0) { return; } NZString ItemCD = new NZString(null, shtItemView.Cells[shtItemView.ActiveRowIndex, (int)eColView.UPPER_ITEM_CD].Text); ItemValidator validator = new ItemValidator(); ErrorItem errorItem = validator.CheckExistsTransactionByItem(ItemCD); if (errorItem != null) { MessageDialog.ShowBusiness(this, errorItem.Message); } MessageDialogResult dr = MessageDialog.ShowConfirmation(this, new EVOFramework.Message(SystemMaintenance.Messages.eConfirm.CFM9002.ToString()).MessageDescription); switch (dr) { case MessageDialogResult.Cancel: return; case MessageDialogResult.No: return; case MessageDialogResult.Yes: break; } ItemController ctlItem = new ItemController(); ctlItem.DeleteItem(ItemCD); shtItemView.RemoveRows(shtItemView.ActiveRowIndex, 1); }
private void LoadData(NZDateTime FromPeriod, NZDateTime ToPeriod, NZString ItemFrom, NZString ItemTo, NZString LotNo) { try { if (ItemFrom == "") { ItemFrom = null; } if (ItemTo == "") { ItemTo = null; } bool GroupByItem = rdoGroupItem.Checked; NGInquiryController ctlInvent = new NGInquiryController(); List <NGInquiryViewDTO> dto = ctlInvent.LoadNGInquiry(FromPeriod, ToPeriod, ItemFrom, ItemTo, GroupByItem, LotNo); if (dto.Count == 0) { MessageDialog.ShowBusiness(this, new EVOFramework.Message(TKPMessages.eInformation.INF0001.ToString())); return; } m_dtAllData = DTOUtility.ConvertListToDataTable(dto); DataTable dtView = m_dtAllData.Clone(); foreach (DataRow dr in m_dtAllData.Rows) { dtView.ImportRow(dr); } //Hide Column When ByGroupItem RefreshSpreadColumn(); fpView.DataSource = dtView; CtrlUtil.MappingDataFieldWithEnum(shtView, typeof(eColumns)); } catch (Exception ex) { MessageDialog.ShowBusiness(this, ex.Message); } }
public void AddMenuSubItems(NZString MENU_SUB_CD, params NZString[] SCREEN_CDs) { Database db = CommonLib.Common.CurrentDatabase; db.KeepConnection = true; db.BeginTransaction(); try { IMenuSubItemDAO dao = DAOFactory.CreateMenuSubItemDAO(db); for (int i = 0; i < SCREEN_CDs.Length; i++) { // Get new seq of MenuSubItem; NZInt seq = dao.GetNewSequenceNo(null, MENU_SUB_CD); MenuSubItemDTO data = new MenuSubItemDTO(); data.MENU_SUB_CD = MENU_SUB_CD; data.SCREEN_CD = SCREEN_CDs[i]; data.DISP_SEQ = seq; data.CRT_BY = CommonLib.Common.CurrentUserInfomation.UserCD; data.CRT_MACHINE = CommonLib.Common.CurrentUserInfomation.Machine; data.UPD_BY = CommonLib.Common.CurrentUserInfomation.UserCD; data.UPD_MACHINE = CommonLib.Common.CurrentUserInfomation.Machine; dao.AddNew(null, data); } db.Commit(); } catch (Exception err) { db.Rollback(); throw err; } finally { if (db.DBConnectionState == ConnectionState.Open) { db.Close(); } } }
/// <summary> /// Update record by using the table's primary key. /// </summary> /// <param name="database"></param> /// <param name="data">Data which to update.</param> /// <param name="oldCUSTOMER_CODE">Old Key #1</param> /// <returns></returns> public int UpdateWithPK(Database database, CustomerDTO data, NZString oldCUSTOMER_CODE) { Database db = UseDatabase(database); StringBuilder sb = new StringBuilder(); #region SQL Statement sb.AppendLine(" UPDATE " + data.TableName); sb.AppendLine(" SET "); sb.AppendLine(" " + CustomerDTO.eColumns.UPD_BY + "=:UPD_BY"); sb.AppendLine(" ," + CustomerDTO.eColumns.UPD_DATE + "=GETDATE()"); sb.AppendLine(" ," + CustomerDTO.eColumns.UPD_MACHINE + "=:UPD_MACHINE"); sb.AppendLine(" ," + CustomerDTO.eColumns.IS_ACTIVE + "=:IS_ACTIVE"); sb.AppendLine(" ," + CustomerDTO.eColumns.CUSTOMER_CODE + "=:CUSTOMER_CODE"); sb.AppendLine(" ," + CustomerDTO.eColumns.CUSTOMER_NAME + "=:CUSTOMER_NAME"); sb.AppendLine(" ," + CustomerDTO.eColumns.ADDRESS + "=:ADDRESS"); sb.AppendLine(" ," + CustomerDTO.eColumns.PHONE_NO + "=:PHONE_NO"); sb.AppendLine(" ," + CustomerDTO.eColumns.FAX + "=:FAX"); sb.AppendLine(" ," + CustomerDTO.eColumns.REMARK + "=:REMARK"); sb.AppendLine(" ," + CustomerDTO.eColumns.DELIVERY_LT + "=:DELIVERY_LT"); sb.AppendLine(" WHERE "); sb.AppendLine(" " + CustomerDTO.eColumns.CUSTOMER_CODE + "=:oldCUSTOMER_CODE"); #endregion DataRequest req = new DataRequest(sb.ToString()); #region Parameters req.Parameters.Add("UPD_BY", DataType.NVarChar, data.UPD_BY.Value); req.Parameters.Add("UPD_MACHINE", DataType.NVarChar, data.UPD_MACHINE.Value); req.Parameters.Add("IS_ACTIVE", DataType.Default, data.IS_ACTIVE.Value); req.Parameters.Add("CUSTOMER_CODE", DataType.NVarChar, data.CUSTOMER_CODE.Value); req.Parameters.Add("CUSTOMER_NAME", DataType.NVarChar, data.CUSTOMER_NAME.Value); req.Parameters.Add("ADDRESS", DataType.NVarChar, data.ADDRESS.Value); req.Parameters.Add("PHONE_NO", DataType.NVarChar, data.PHONE_NO.Value); req.Parameters.Add("FAX", DataType.NVarChar, data.FAX.Value); req.Parameters.Add("REMARK", DataType.NVarChar, data.REMARK.Value); req.Parameters.Add("DELIVERY_LT", DataType.Number, data.DELIVERY_LT.Value); req.Parameters.Add("oldCUSTOMER_CODE", DataType.NVarChar, oldCUSTOMER_CODE.Value); #endregion return(db.ExecuteNonQuery(req)); }
/// <summary> /// Load with specified primary key. /// </summary> /// <param name="database"></param> /// <param name="CUSTOMER_CD">Key #1</param> /// <param name="DUE_DATE">Key #2</param> /// <param name="ITEM_CD">Key #3</param> /// <returns></returns> public TmpDemandOrderDTO LoadByPK(Database database, NZString CUSTOMER_CD, NZDateTime DUE_DATE, NZString ITEM_CD) { Database db = UseDatabase(database); StringBuilder sb = new StringBuilder(); #region SQL Statement string tableName = EVOFramework.Data.DTOUtility.ReadTableName(typeof(TmpDemandOrderDTO)); sb.AppendLine(" SELECT "); sb.AppendLine(" " + TmpDemandOrderDTO.eColumns.CRT_BY); sb.AppendLine(" ," + TmpDemandOrderDTO.eColumns.CRT_DATE); sb.AppendLine(" ," + TmpDemandOrderDTO.eColumns.CRT_MACHINE); sb.AppendLine(" ," + TmpDemandOrderDTO.eColumns.YEAR_MONTH); sb.AppendLine(" ," + TmpDemandOrderDTO.eColumns.CUSTOMER_CD); sb.AppendLine(" ," + TmpDemandOrderDTO.eColumns.DUE_DATE); sb.AppendLine(" ," + TmpDemandOrderDTO.eColumns.ITEM_CD); sb.AppendLine(" ," + TmpDemandOrderDTO.eColumns.ORDER_QTY); sb.AppendLine(" ," + TmpDemandOrderDTO.eColumns.ORDER_TYPE); sb.AppendLine(" FROM " + tableName); sb.AppendLine(" WHERE "); sb.AppendLine(" " + TmpDemandOrderDTO.eColumns.CUSTOMER_CD + "=:CUSTOMER_CD"); sb.AppendLine(" AND " + TmpDemandOrderDTO.eColumns.DUE_DATE + "=:DUE_DATE"); sb.AppendLine(" AND " + TmpDemandOrderDTO.eColumns.ITEM_CD + "=:ITEM_CD"); #endregion DataRequest req = new DataRequest(sb.ToString()); #region Parameters req.Parameters.Add("CUSTOMER_CD", DataType.NVarChar, CUSTOMER_CD.Value); req.Parameters.Add("DUE_DATE", DataType.DateTime, DUE_DATE.Value); req.Parameters.Add("ITEM_CD", DataType.NVarChar, ITEM_CD.Value); #endregion List <TmpDemandOrderDTO> list = db.ExecuteForList <TmpDemandOrderDTO>(req); if (list != null && list.Count > 0) { return(list[0]); } return(null); }
/// <summary> /// Update record by using the table's primary key. /// </summary> /// <param name="database"></param> /// <param name="data">Data which to update.</param> /// <param name="oldUPPER_ITEM_CD">Old Key #1</param> /// <param name="oldLOWER_ITEM_CD">Old Key #2</param> /// <param name="oldITEM_SEQ">Old Key #3</param> /// <returns></returns> public int UpdateWithPK(Database database, BOMDTO data, NZString oldUPPER_ITEM_CD, NZString oldLOWER_ITEM_CD, NZInt oldITEM_SEQ) { Database db = UseDatabase(database); StringBuilder sb = new StringBuilder(); #region SQL Statement sb.AppendLine(" UPDATE " + data.TableName); sb.AppendLine(" SET "); sb.AppendLine(" " + BOMDTO.eColumns.UPD_BY + "=@UPD_BY"); sb.AppendLine(" ," + BOMDTO.eColumns.UPD_DATE + "=GETDATE()"); sb.AppendLine(" ," + BOMDTO.eColumns.UPD_MACHINE + "=@UPD_MACHINE"); sb.AppendLine(" ," + BOMDTO.eColumns.UPPER_ITEM_CD + "=@UPPER_ITEM_CD"); sb.AppendLine(" ," + BOMDTO.eColumns.LOWER_ITEM_CD + "=@LOWER_ITEM_CD"); sb.AppendLine(" ," + BOMDTO.eColumns.ITEM_SEQ + "=@ITEM_SEQ"); sb.AppendLine(" ," + BOMDTO.eColumns.UPPER_QTY + "=@UPPER_QTY"); sb.AppendLine(" ," + BOMDTO.eColumns.LOWER_QTY + "=@LOWER_QTY"); sb.AppendLine(" ," + BOMDTO.eColumns.OLD_DATA + "=@OLD_DATA"); sb.AppendLine(" WHERE "); sb.AppendLine(" " + BOMDTO.eColumns.UPPER_ITEM_CD + "=@oldUPPER_ITEM_CD"); sb.AppendLine(" AND " + BOMDTO.eColumns.LOWER_ITEM_CD + "=@oldBOM"); sb.AppendLine(" AND " + BOMDTO.eColumns.ITEM_SEQ + "=@oldBOM"); #endregion DataRequest req = new DataRequest(sb.ToString()); #region Parameters req.Parameters.Add("@UPD_BY", DataType.NVarChar, data.UPD_BY.Value); req.Parameters.Add("@UPD_MACHINE", DataType.NVarChar, data.UPD_MACHINE.Value); req.Parameters.Add("@UPPER_ITEM_CD", DataType.Default, data.UPPER_ITEM_CD.Value); req.Parameters.Add("@LOWER_ITEM_CD", DataType.Default, data.LOWER_ITEM_CD.Value); req.Parameters.Add("@ITEM_SEQ", DataType.Default, data.ITEM_SEQ.Value); req.Parameters.Add("@UPPER_QTY", DataType.Number, data.UPPER_QTY.Value); req.Parameters.Add("@LOWER_QTY", DataType.Number, data.LOWER_QTY.Value); req.Parameters.Add("@OLD_DATA", DataType.Default, data.OLD_DATA.Value); req.Parameters.Add("@oldUPPER_ITEM_CD", DataType.Default, oldUPPER_ITEM_CD); req.Parameters.Add("@oldLOWER_ITEM_CD", DataType.Default, oldLOWER_ITEM_CD); req.Parameters.Add("@oldITEM_SEQ", DataType.Default, oldITEM_SEQ); #endregion return(db.ExecuteNonQuery(req)); }
private void fpIssueList_EditModeOff(object sender, EventArgs e) { eColView eActiveCol = (eColView)shtIssueList.ActiveColumnIndex; int ActiveRow = shtIssueList.ActiveRowIndex; NZString ItemCD = new NZString(null, shtIssueList.Cells[ActiveRow, (int)eColView.ITEM_CODE].Value); NZString LotNo = new NZString(null, shtIssueList.Cells[ActiveRow, (int)eColView.LOT_NO].Value); NZString LocCD = new NZString(cboFromLoc, cboFromLoc.SelectedValue); switch (eActiveCol) { case eColView.ITEM_CODE: shtIssueList.Cells[ActiveRow, (int)eColView.ONHAND_QTY].Value = GetOnhandQty(ItemCD, LocCD, LotNo); break; case eColView.LOT_NO: // Load Onhand qty shtIssueList.Cells[ActiveRow, (int)eColView.ONHAND_QTY].Value = GetOnhandQty(ItemCD, LocCD, LotNo); break; } }
public DataTable CheckUnpackInventory(Database database, NZString GroupTransID) { Database db = UseDatabase(database); DataRequest req = new DataRequest(); req.CommandText = "S_TRN310_CheckUnpackInventory"; req.CommandType = CommandType.StoredProcedure; #region Parameters req.Parameters.Add("@GroupTransID", DataType.NVarChar, GroupTransID.Value); #endregion DataSet ds = db.ExecuteDataSet(req); if (ds != null && ds.Tables.Count > 0) { return(ds.Tables[0]); } return(null); }
private void LoadLookupCellType() { LookupDataBIZ bizLookup = new LookupDataBIZ(); LookupData machineTypeData = bizLookup.LoadLookupClassType(DataDefine.MACHINE_TYPE.ToNZString()); ReadOnlyPairCellType cellmachineType = new ReadOnlyPairCellType(machineTypeData, CommonLib.Common.COMBOBOX_SEPERATOR_SYMBOL); shtView.Columns[(int)eColView.MACHINE_TYPE].CellType = cellmachineType; LookupData machineProjectData = bizLookup.LoadLookupClassType(DataDefine.MACHINE_PROJECT.ToNZString()); ReadOnlyPairCellType cellProjectType = new ReadOnlyPairCellType(machineProjectData, CommonLib.Common.COMBOBOX_SEPERATOR_SYMBOL); shtView.Columns[(int)eColView.PROJECT].CellType = cellProjectType; NZString[] locationtype = new NZString[1]; locationtype[0] = DataDefine.Convert2ClassCode(DataDefine.eLOCATION_CLS.Production).ToNZString(); LookupData locationData = bizLookup.LoadLookupLocation(locationtype); ReadOnlyPairCellType cellProcess = new ReadOnlyPairCellType(locationData, CommonLib.Common.COMBOBOX_SEPERATOR_SYMBOL); shtView.Columns[(int)eColView.PROCESS_CD].CellType = cellProcess; }
public void DeleteItem(NZString OrderNo, NZString OrderDetailNo) { try { Common.CurrentDatabase.KeepConnection = true; Common.CurrentDatabase.BeginTransaction(); CustomerOrderBIZ biz = new CustomerOrderBIZ(); CustomerOrderViewDTO dtoDelItem = new CustomerOrderViewDTO(); dtoDelItem.ORDER_NO = OrderNo; dtoDelItem.ORDER_DETAIL_NO = OrderDetailNo; biz.DeleteCustomerOrderDetail(Common.CurrentDatabase, dtoDelItem); biz.UpdateCustomerHeaderTotal(Common.CurrentDatabase, dtoDelItem); Common.CurrentDatabase.Commit(); } catch (Exception ex) { Common.CurrentDatabase.Rollback(); throw ex; } }
private void OnEdit() { if (!ActivePermission.Edit) { return; } NZString strMRPNo = new NZString(null, shtView.Cells[shtView.ActiveRowIndex, (int)eColView.MRP_NO].Value); NZString strItemCD = new NZString(null, shtView.Cells[shtView.ActiveRowIndex, (int)eColView.ITEM_CD].Value); NZString strLocCD = new NZString(null, shtView.Cells[shtView.ActiveRowIndex, (int)eColView.ORDER_LOC_CD].Value); NZInt iRevision = new NZInt(null, shtView.Cells[shtView.ActiveRowIndex, (int)eColView.REVISION_NO].Value); NZDateTime dtmPeriodFrom = new NZDateTime(null, dtPeriodBegin.Value); NZDateTime dtmPeriodTo = new NZDateTime(null, dtPeriodEnd.Value); MRP030_MRPMaintenance MRP020 = new MRP030_MRPMaintenance(strMRPNo, iRevision, strItemCD, strLocCD, dtmPeriodFrom, dtmPeriodTo); if (MRP020.ShowDialog(null) == DialogResult.OK) { LoadData(dtPeriodBegin.NZValue, dtPeriodEnd.NZValue); } }
private void fpView_CellDoubleClick(object sender, FarPoint.Win.Spread.CellClickEventArgs e) { if (!ActivePermission.Edit) { return; } if (shtView.Rows.Count == 0) { return; } if (shtView.ActiveRowIndex < 0) { return; } NZString TranID = new NZString(null, shtView.Cells[shtView.ActiveRowIndex, (int)eColView.ISSUE_NO].Value); OpenIssueScreen(CheckIssueDate(TranID)); LoadData(); }
public ItemProcessDTO LoadDefaultProcessOfItem(Database database, NZString ItemCD, NZString ProcessCD) { Database db = UseDatabase(database); DataRequest req = new DataRequest("S_TRN300_LoadDefaultProcess"); req.CommandType = CommandType.StoredProcedure; req.Parameters.Add("@pVar_ItemCD", ItemCD.Value); req.Parameters.Add("@pVar_Process_CD", ProcessCD.Value); List <ItemProcessDTO> list = db.ExecuteForList <ItemProcessDTO>(req); if (list == null || list.Count == 0) { return(null); } else { return(list[0]); } }
/// <summary> /// Delete record with key. /// </summary> /// <param name="database"></param> /// <param name="SYS_GROUP_ID">Key #1</param> /// <param name="SYS_KEY">Key #2</param> /// <returns></returns> public int Delete(Database database, NZString SYS_GROUP_ID, NZString SYS_KEY) { Database db = UseDatabase(database); StringBuilder sb = new StringBuilder(); #region SQL Statement string tableName = EVOFramework.Data.DTOUtility.ReadTableName(typeof(SysConfigDTO)); sb.AppendLine(" DELETE FROM " + tableName); sb.AppendLine(" WHERE "); sb.AppendLine(" " + SysConfigDTO.eColumns.SYS_GROUP_ID + "=:SYS_GROUP_ID"); sb.AppendLine(" AND " + SysConfigDTO.eColumns.SYS_KEY + "=:SYS_KEY"); #endregion DataRequest req = new DataRequest(sb.ToString()); #region Parameters req.Parameters.Add("SYS_GROUP_ID", DataType.VarChar, SYS_GROUP_ID.Value); req.Parameters.Add("SYS_KEY", DataType.VarChar, SYS_KEY.Value); #endregion return(db.ExecuteNonQuery(req)); }
/// <summary> /// Check exists the specified key. /// </summary> public bool Exist(Database database, NZString GROUP_CD) { Database db = UseDatabase(database); StringBuilder sb = new StringBuilder(); #region SQL Statement string tableName = EVOFramework.Data.DTOUtility.ReadTableName(typeof(UserGroupDTO)); sb.AppendLine(" SELECT TOP 1 1 "); sb.AppendLine(" FROM " + tableName); sb.AppendLine(" WHERE "); sb.AppendLine(" " + UserGroupDTO.eColumns.GROUP_CD + "=:GROUP_CD"); #endregion DataRequest req = new DataRequest(sb.ToString()); #region Parameters req.Parameters.Add("GROUP_CD", DataType.NVarChar, GROUP_CD.Value); #endregion return(db.ExecuteQuery(req).Rows.Count > 0); }
/// <summary> /// Update record by using the table's primary key. /// </summary> /// <param name="database"></param> /// <param name="data">Data which to update.</param> /// <param name="oldSCREEN_CD">Old Key #1</param> /// <returns></returns> public int UpdateWithPK(Database database, ScreenDTO data, NZString oldSCREEN_CD) { Database db = UseDatabase(database); StringBuilder sb = new StringBuilder(); #region SQL Statement sb.AppendLine(" UPDATE " + data.TableName); sb.AppendLine(" SET "); sb.AppendLine(" " + ScreenDTO.eColumns.SCREEN_CD + "=:SCREEN_CD"); sb.AppendLine(" ," + ScreenDTO.eColumns.SCREEN_NAME + "=:SCREEN_NAME"); sb.AppendLine(" ," + ScreenDTO.eColumns.IMAGE_CD + "=:IMAGE_CD"); sb.AppendLine(" ," + ScreenDTO.eColumns.SCREEN_TYPE + "=:SCREEN_TYPE"); sb.AppendLine(" ," + ScreenDTO.eColumns.SCREEN_ACTION + "=:SCREEN_ACTION"); sb.AppendLine(" ," + ScreenDTO.eColumns.EXT_PROGRAM + "=:EXT_PROGRAM"); sb.AppendLine(" ," + ScreenDTO.eColumns.UPD_BY + "=:UPD_BY"); sb.AppendLine(" ," + ScreenDTO.eColumns.UPD_DATE + "=SYSDATE"); sb.AppendLine(" ," + ScreenDTO.eColumns.UPD_MACHINE + "=:UPD_MACHINE"); sb.AppendLine(" ," + ScreenDTO.eColumns.ORIGINAL_TITLE + "=:ORIGINAL_TITLE"); sb.AppendLine(" WHERE "); sb.AppendLine(" " + ScreenDTO.eColumns.SCREEN_CD + "=:oldSCREEN_CD"); #endregion DataRequest req = new DataRequest(sb.ToString()); #region Parameters req.Parameters.Add("SCREEN_CD", DataType.VarChar, data.SCREEN_CD.Value); req.Parameters.Add("SCREEN_NAME", DataType.NVarChar, data.SCREEN_NAME.Value); req.Parameters.Add("IMAGE_CD", DataType.VarChar, data.IMAGE_CD.Value); req.Parameters.Add("SCREEN_TYPE", DataType.Number, data.SCREEN_TYPE.Value); req.Parameters.Add("SCREEN_ACTION", DataType.Number, data.SCREEN_ACTION.Value); req.Parameters.Add("EXT_PROGRAM", DataType.VarChar, data.EXT_PROGRAM.Value); req.Parameters.Add("UPD_BY", DataType.NVarChar, data.UPD_BY.Value); req.Parameters.Add("UPD_MACHINE", DataType.NVarChar, data.UPD_MACHINE.Value); req.Parameters.Add("ORIGINAL_TITLE", DataType.NVarChar, data.ORIGINAL_TITLE.Value); req.Parameters.Add("oldSCREEN_CD", DataType.VarChar, oldSCREEN_CD.Value); #endregion return(db.ExecuteNonQuery(req)); }
/// <summary> /// Delete record with key. /// </summary> /// <param name="database"></param> /// <param name="UPPER_USER_ACCOUNT">Key #1</param> /// <param name="LOWER_USER_ACCOUNT">Key #2</param> /// <returns></returns> public int Delete(Database database, NZString UPPER_USER_ACCOUNT, NZString LOWER_USER_ACCOUNT) { Database db = UseDatabase(database); StringBuilder sb = new StringBuilder(); #region SQL Statement string tableName = EVOFramework.Data.DTOUtility.ReadTableName(typeof(UserDTO)); sb.AppendLine(" DELETE FROM " + tableName); sb.AppendLine(" WHERE "); sb.AppendLine(" " + UserDTO.eColumns.UPPER_USER_ACCOUNT + "=:UPPER_USER_ACCOUNT"); sb.AppendLine(" AND " + UserDTO.eColumns.LOWER_USER_ACCOUNT + "=:LOWER_USER_ACCOUNT"); #endregion DataRequest req = new DataRequest(sb.ToString()); #region Parameters req.Parameters.Add("UPPER_USER_ACCOUNT", DataType.NVarChar, UPPER_USER_ACCOUNT.Value); req.Parameters.Add("LOWER_USER_ACCOUNT", DataType.NVarChar, LOWER_USER_ACCOUNT.Value); #endregion return(db.ExecuteNonQuery(req)); }
/// <summary> /// Delete record with key. /// </summary> /// <param name="database"></param> /// <param name="SCREEN_CD">Key #1</param> /// <param name="USER_CD">Key #2</param> /// <returns></returns> public int Delete(Database database, NZString SCREEN_CD, NZString USER_CD) { Database db = UseDatabase(database); StringBuilder sb = new StringBuilder(); #region SQL Statement string tableName = EVOFramework.Data.DTOUtility.ReadTableName(typeof(UserScreenPermissionDTO)); sb.AppendLine(" DELETE FROM " + tableName); sb.AppendLine(" WHERE "); sb.AppendLine(" " + UserScreenPermissionDTO.eColumns.SCREEN_CD + "=:SCREEN_CD"); sb.AppendLine(" AND " + UserScreenPermissionDTO.eColumns.USER_CD + "=:USER_CD"); #endregion DataRequest req = new DataRequest(sb.ToString()); #region Parameters req.Parameters.Add("SCREEN_CD", DataType.VarChar, SCREEN_CD.Value); req.Parameters.Add("USER_CD", DataType.VarChar, USER_CD.Value); #endregion return(db.ExecuteNonQuery(req)); }
/// <summary> /// Update record by using the table's primary key. /// </summary> /// <param name="database"></param> /// <param name="data">Data which to update.</param> /// <param name="oldSCREEN_CD">Old Key #1</param> /// <param name="oldUSER_CD">Old Key #2</param> /// <returns></returns> public int UpdateWithPK(Database database, UserScreenPermissionDTO data, NZString oldSCREEN_CD, NZString oldUSER_CD) { Database db = UseDatabase(database); StringBuilder sb = new StringBuilder(); #region SQL Statement sb.AppendLine(" UPDATE " + data.TableName); sb.AppendLine(" SET "); sb.AppendLine(" " + UserScreenPermissionDTO.eColumns.SCREEN_CD + "=:SCREEN_CD"); sb.AppendLine(" ," + UserScreenPermissionDTO.eColumns.USER_CD + "=:USER_CD"); sb.AppendLine(" ," + UserScreenPermissionDTO.eColumns.FLG_VIEW + "=:FLG_VIEW"); sb.AppendLine(" ," + UserScreenPermissionDTO.eColumns.FLG_ADD + "=:FLG_ADD"); sb.AppendLine(" ," + UserScreenPermissionDTO.eColumns.FLG_CHG + "=:FLG_CHG"); sb.AppendLine(" ," + UserScreenPermissionDTO.eColumns.FLG_DEL + "=:FLG_DEL"); sb.AppendLine(" ," + UserScreenPermissionDTO.eColumns.UPD_BY + "=:UPD_BY"); sb.AppendLine(" ," + UserScreenPermissionDTO.eColumns.UPD_DATE + "=GETDATE()"); sb.AppendLine(" ," + UserScreenPermissionDTO.eColumns.UPD_MACHINE + "=:UPD_MACHINE"); sb.AppendLine(" WHERE "); sb.AppendLine(" " + UserScreenPermissionDTO.eColumns.SCREEN_CD + "=:oldSCREEN_CD"); sb.AppendLine(" AND " + UserScreenPermissionDTO.eColumns.USER_CD + "=:oldUserScreenPermission"); #endregion DataRequest req = new DataRequest(sb.ToString()); #region Parameters req.Parameters.Add("SCREEN_CD", DataType.VarChar, data.SCREEN_CD.Value); req.Parameters.Add("USER_CD", DataType.VarChar, data.USER_CD.Value); req.Parameters.Add("FLG_VIEW", DataType.Number, data.FLG_VIEW.Value); req.Parameters.Add("FLG_ADD", DataType.Number, data.FLG_ADD.Value); req.Parameters.Add("FLG_CHG", DataType.Number, data.FLG_CHG.Value); req.Parameters.Add("FLG_DEL", DataType.Number, data.FLG_DEL.Value); req.Parameters.Add("UPD_BY", DataType.NVarChar, data.UPD_BY.Value); req.Parameters.Add("UPD_MACHINE", DataType.NVarChar, data.UPD_MACHINE.Value); req.Parameters.Add("oldSCREEN_CD", DataType.VarChar, oldSCREEN_CD.Value); req.Parameters.Add("oldUSER_CD", DataType.VarChar, oldUSER_CD.Value); #endregion return(db.ExecuteNonQuery(req)); }
private bool RunProcess(eMonthlyCloseProcess ePrcsType) { try { this.Cursor = Cursors.WaitCursor; picWaiting.Visible = true; InventoryBIZ biz = new InventoryBIZ(); NZString YearMonth = new NZString(null, Convert.ToDateTime(dtInventoryMonth.DateValue).ToString("yyyyMM")); //pgbProgress.PerformStep(); biz.RunInventoryClosingProcess(ePrcsType); return(true); } catch (Exception ex) { MessageDialog.ShowBusiness(this, ex.Message); } finally { this.Cursor = Cursors.Default; picWaiting.Visible = false; } return(false); }
/// <summary> /// Check exists the specified key. /// </summary> public bool Exist(Database database, NZString SCREEN_CD) { Database db = UseDatabase(database); StringBuilder sb = new StringBuilder(); #region SQL Statement string tableName = EVOFramework.Data.DTOUtility.ReadTableName(typeof(ScreenDTO)); sb.AppendLine(" SELECT 1 "); sb.AppendLine(" FROM " + tableName); sb.AppendLine(" WHERE ROWNUM=1"); sb.AppendLine(" AND " + ScreenDTO.eColumns.SCREEN_CD + "=:SCREEN_CD"); #endregion DataRequest req = new DataRequest(sb.ToString()); #region Parameters req.Parameters.Add("SCREEN_CD", DataType.VarChar, SCREEN_CD.Value); #endregion return(db.ExecuteQuery(req).Rows.Count > 0); }