internal static IDBFunctions CreateDBFunctions(DBAdapters dba) { IDBFunctions func = null; switch (dba) { case DBAdapters.DB2: func = new DB2Functions(); break; case DBAdapters.SQLSERVER: func = new SQLServerFunctions(); break; case DBAdapters.ODBC: func = new OdbcFunctions(); break; case DBAdapters.WS: func = new WSFunctions(); break; } return(func); }
/// <summary> /// 일정을 마우스 이벤트로 변경하였을 경우 /// </summary> /// <param name="pSeq"></param> /// <param name="pStart"></param> /// <param name="pEnd"></param> private void EditScheduleTime(string pSeq, string pStart, string pEnd) { DataSet ds = new DataSet(); DBAdapters dbA = new DBAdapters { LocalInfo = new LocalInfo(_strUserID, System.Reflection.MethodBase.GetCurrentMethod()) }; dbA.BindingConfig.ConnectDBName = _CONNDB; dbA.Procedure.ProcedureName = "ICPMSDB.dbo.USP_CSN_Set_Edit_CDS_Time";//해당 자산을 입력된 시간에 사용할 수 있는지 확인하는 프로시저 dbA.Procedure.ParamAdd("SEQ", pSeq); dbA.Procedure.ParamAdd("시작일시", pStart); dbA.Procedure.ParamAdd("종료일시", pEnd); try { Cursor = Cursors.WaitCursor; ds = dbA.ProcedureToDataSet(); XtraMessageBox.Show("저장이 완료되었습니다.", "안내", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception e) { XtraMessageBox.Show(e.Message, "오류", MessageBoxButtons.OK, MessageBoxIcon.Information); } finally { Cursor = Cursors.Default; } }
/// <summary> /// 입력된 자산이 입력된 일시에 사용중인지 체크 /// </summary> /// <param name="assetNumber">자산번호</param> /// <param name="yearMonth">년월</param> /// <param name="startHM">시작시각</param> /// <param name="endHM">종료시각</param> /// <returns>사용중이 아니라면 true, 사용중이라면 false</returns> private bool CheckDuplicateSchedule(string assetNumber, string yearMonth, string startHM, string endHM, string pSeq) { DataSet ds = new DataSet(); DBAdapters dbA = new DBAdapters { LocalInfo = new LocalInfo(_strUserID, System.Reflection.MethodBase.GetCurrentMethod()) }; dbA.BindingConfig.ConnectDBName = _CONNDB; dbA.Procedure.ProcedureName = "ICPMSDB.dbo.USP_CSN_Assets_Check_Schedule";//해당 자산을 입력된 시간에 사용할 수 있는지 확인하는 프로시저 dbA.Procedure.ParamAdd("자산번호", assetNumber); dbA.Procedure.ParamAdd("시작일", yearMonth); dbA.Procedure.ParamAdd("시작시간", startHM); dbA.Procedure.ParamAdd("종료시간", endHM); dbA.Procedure.ParamAdd("SEQ", pSeq); try { Cursor = Cursors.WaitCursor; ds = dbA.ProcedureToDataSet(); if (ds.Tables.Count > 0) //조회된 테이블이 있다면 { if (ds.Tables[0].Rows.Count > 0) //테이블의 행수가 0보다 크다면 { if (Convert.ToInt32(ds.Tables[0].Rows[0]["return"]) > 0) //겹치는게 있으면 { return(false); } else//겹치는게 없으면 { return(true); } } else//테이블의 행수가 0보다 작으면 { return(true); } } else//조회된 테이블이 없다면 { return(true); } } catch (Exception e) { XtraMessageBox.Show(e.Message, "오류", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } finally { Cursor = Cursors.Default; } }
/// <summary> /// 캘린더 새로고침 /// </summary> /// <param name="storeCode">창고코드</param> /// <param name="itemCode">장비코드</param> private void RefreshCalendar(string storeCode, string itemCode) { DataSet ds = new DataSet(); DBAdapters dbA = new DBAdapters { LocalInfo = new LocalInfo(_strUserID, System.Reflection.MethodBase.GetCurrentMethod()) }; dbA.BindingConfig.ConnectDBName = _CONNDB; dbA.Procedure.ProcedureName = "ICPMSDB.dbo.Usp_CSN_Get_CommonDeviceSchedule";//자산 스케쥴을 가져오는 프로시저 dbA.Procedure.ParamAdd("창고코드", storeCode); dbA.Procedure.ParamAdd("장비코드", itemCode); //string yearMonth = dateNavigator.DateTime.ToShortDateString(); //yearMonth = yearMonth.Replace("-", "").Substring(0, 6); //dbA.Procedure.ParamAdd("조회년월", yearMonth); try { Cursor = Cursors.WaitCursor; ds = dbA.ProcedureToDataSet(); //schedulerStorage.Appointments.ResourceSharing = true; schedulerStorage.Appointments.DataSource = null; schedulerStorage.Appointments.DataSource = ds.Tables[0]; schedulerStorage.Appointments.Mappings.Start = ds.Tables[0].Columns["시작일시"].ToString(); schedulerStorage.Appointments.Mappings.End = ds.Tables[0].Columns["종료일시"].ToString(); schedulerStorage.Appointments.Mappings.Subject = ds.Tables[0].Columns["고객명"].ToString(); schedulerStorage.Appointments.Mappings.Location = ds.Tables[0].Columns["고객코드"].ToString(); schedulerStorage.Appointments.Mappings.Description = ds.Tables[0].Columns["DESCRIPTION"].ToString(); schedulerStorage.Appointments.Mappings.Label = ds.Tables[0].Columns["SEQ"].ToString(); schedulerStorage.Appointments.Mappings.AppointmentId = ds.Tables[0].Columns["신청자"].ToString(); _usePurpose = ds.Tables[0].Columns["사용목적"].ToString(); schedulerControl.Storage = schedulerStorage; if (schedulerControl.Services.SchedulerState.IsDataRefreshAllowed) { schedulerControl.RefreshData(); } } catch (Exception e) { XtraMessageBox.Show(e.Message, "오류", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { Cursor = Cursors.Default; } }
/// <summary> /// 해당 창고의 장비리스트를 가져옴 /// </summary> /// <param name="whscd">창고코드</param> private void GetItemList(string whscd) { _storeCode = uC_StoreCode.EditValue.ToString(); DataSet ds = new DataSet(); DBAdapters dbA = new DBAdapters { LocalInfo = new LocalInfo(_strUserID, System.Reflection.MethodBase.GetCurrentMethod()) }; dbA.BindingConfig.ConnectDBName = _CONNDB; dbA.Procedure.ProcedureName = "ICPMSDB.dbo.Usp_CSN_Get_ItemList";//해당 창고의 장비리스트를 가져오는 프로시저 dbA.Procedure.ParamAdd("WHSCD", whscd); //dbA.Procedure.ParamAdd("DEPTCD", _strDeptCode); try { Cursor = Cursors.WaitCursor; ds = dbA.ProcedureToDataSet(); if (ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0) //조회된 내용이 없으면 { //경고 후 리턴 XtraMessageBox.Show("장비의 조회된 내역이 없습니다.", "안내", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } LUE_ItemList.DataBindings.Clear(); LUE_ItemList.Properties.Columns.Clear(); LUE_ItemList.Properties.Columns.Add(new LookUpColumnInfo("ITEMKNM", "장비명")); LUE_ItemList.Properties.Columns.Add(new LookUpColumnInfo("ITEMCD", "장비코드")); LUE_ItemList.Properties.Columns["ITEMCD"].Visible = false; LUE_ItemList.Properties.DisplayMember = "ITEMKNM"; LUE_ItemList.Properties.ValueMember = "ITEMCD"; LUE_ItemList.Properties.DataSource = ds.Tables[0].DefaultView; RefreshCalendar(_storeCode, _itemCode);//캘린더 갱신 } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "오류", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { Cursor = Cursors.Default; } }