private void InitControls() { #region Customer cboCustomer.Params.Add("strCompType", "C"); cboCustomer.BindDataSet(); #endregion Customer #region Model Type cboType.Params.Add("strItem", "MODEL_TYPE"); cboType.BindDataSet(); #endregion Model Type CheckComboBox cbotmp = new CheckComboBox() { Sql = "CommonSearch#getCommonItems" }; cbotmp.Params.Add("strItem", "QTY_CODE"); cbotmp.BindDataSet(); dt_QtyCd = cbotmp.DataSource; cbotmp.Sql = "CommonSearch#getCompList"; cbotmp.Params.Clear(); cbotmp.Params.Add("strCompType", "V"); cbotmp.BindDataSet(); dt_VendorCd = cbotmp.DataSource; rdoCust.Checked = true; }
private void InitControls() { #region Model Type cboType.Params.Add("strItem", "MODEL_TYPE"); cboType.BindDataSet(); #endregion Model Type #region 장비상태 cboStatus.Params.Add("strItem", "EQP_STATUS"); cboStatus.BindDataSet(); _dtStatus = cboStatus.DataSource; #endregion 장비상태 CheckComboBox cbo = new CheckComboBox() { Sql = "CommonSearch#getUserList" }; cbo.Params.Clear(); cbo.Params.Add("strCompType", "M,C,V"); cbo.BindDataSet(); _dtUser = cbo.DataSource; cbo = new CheckComboBox() { Sql = "CommonSearch#getCompList" }; cbo.Params.Clear(); cbo.Params.Add("strCompType", "M,C,V"); cbo.BindDataSet(); _dtComp = cbo.DataSource; cbo = new CheckComboBox() { Sql = "CommonSearch#getVerList" }; cbo.Params.Clear(); cbo.Params.Add("strModel", ""); cbo.BindDataSet(); _dtVer = cbo.DataSource; cbo = new CheckComboBox() { Sql = "CommonSearch#getManagerCode" }; cbo.Params.Clear(); cbo.Params.Add("strCompCode", ""); cbo.BindDataSet(); _dtMgrCode = cbo.DataSource; DataRow nr = _dtMgrCode.NewRow(); nr["ITEM_CD"] = ""; nr["ITEM_NM"] = "(선택없음)"; _dtMgrCode.Rows.Add(nr); }
private void InitControls() { cboPlan.Params.Clear(); cboPlan.Params.Add("strUserId", DTOFactory.UserId); cboPlan.Params.Add("strDocType", "21"); cboPlan.Params.Add("strDocType2", DOC_TYP_CD); cboPlan.BindDataSet(); cbockMember.MultiSelection = true; cbockMember.Params.Clear(); cbockMember.Params.Add("strCompType", "M"); cbockMember.BindDataSet(); txtUserName.Text = DTOFactory.UserName; txtWorkDesc.Text = DTOFactory.TeamName; txtGrade.Text = DTOFactory.Grade; }
private void ExcelExport(object sender, EventArgs e) { try { //2021-01-07 hsh 파일명 규칙에 어긋나는 문자열 제거 (초기버전) string path = @"c:\temp\" + txtSubject.Text.Replace("/", "_").Replace(@"\", "_") + ".xlsx"; Excel.Application app = new Excel.Application(); Excel.Workbook work = app.Workbooks.Add(); Excel._Worksheet sheet = (Excel._Worksheet)app.ActiveSheet; app.ActiveWindow.DisplayGridlines = false; CheckComboBox cbo = new CheckComboBox() { Sql = "CommonSearch#getUserGrade" }; cbo.MultiSelection = true; cbo.Params.Clear(); cbo.Params.Add("strCompType", ""); cbo.Params.Add("strCompCode", ""); cbo.BindDataSet(); #region Width / Height 정의 ((Excel.Range)sheet.Cells[1, 1]).EntireColumn.ColumnWidth = 2; ((Excel.Range)sheet.Cells[1, 2]).EntireColumn.ColumnWidth = 2; ((Excel.Range)sheet.Cells[1, 3]).EntireColumn.ColumnWidth = 10.25; ((Excel.Range)sheet.Cells[1, 4]).EntireColumn.ColumnWidth = 21.63; ((Excel.Range)sheet.Cells[1, 5]).EntireColumn.ColumnWidth = 23.63; ((Excel.Range)sheet.Cells[1, 6]).EntireColumn.ColumnWidth = 2; ((Excel.Range)sheet.Cells[1, 1]).EntireRow.RowHeight = 17.25; ((Excel.Range)sheet.Cells[2, 1]).EntireRow.RowHeight = 16.5; ((Excel.Range)sheet.Cells[3, 1]).EntireRow.RowHeight = 26.25; ((Excel.Range)sheet.Cells[4, 1]).EntireRow.RowHeight = 16.5; ((Excel.Range)sheet.Cells[5, 1]).EntireRow.RowHeight = 16.5; ((Excel.Range)sheet.Cells[6, 1]).EntireRow.RowHeight = 16.5; ((Excel.Range)sheet.Cells[7, 1]).EntireRow.RowHeight = 16.5; ((Excel.Range)sheet.Cells[8, 1]).EntireRow.RowHeight = 216; ((Excel.Range)sheet.Cells[9, 1]).EntireRow.RowHeight = 16.5; ((Excel.Range)sheet.Cells[10, 1]).EntireRow.RowHeight = 16.5; ((Excel.Range)sheet.Cells[11, 1]).EntireRow.RowHeight = 17.25; #endregion #region 외곽선 정의 sheet.Range["B2", "F11"].Borders[Excel.XlBordersIndex.xlEdgeLeft].LineStyle = Excel.XlLineStyle.xlContinuous; sheet.Range["B2", "F11"].Borders[Excel.XlBordersIndex.xlEdgeTop].LineStyle = Excel.XlLineStyle.xlContinuous; sheet.Range["B2", "F11"].Borders[Excel.XlBordersIndex.xlEdgeRight].LineStyle = Excel.XlLineStyle.xlContinuous; sheet.Range["B2", "F11"].Borders[Excel.XlBordersIndex.xlEdgeBottom].LineStyle = Excel.XlLineStyle.xlContinuous; sheet.Range["C5", "E10"].Borders[Excel.XlBordersIndex.xlEdgeLeft].LineStyle = Excel.XlLineStyle.xlContinuous; sheet.Range["C5", "E10"].Borders[Excel.XlBordersIndex.xlEdgeTop].LineStyle = Excel.XlLineStyle.xlContinuous; sheet.Range["C5", "E10"].Borders[Excel.XlBordersIndex.xlEdgeRight].LineStyle = Excel.XlLineStyle.xlContinuous; sheet.Range["C5", "E10"].Borders[Excel.XlBordersIndex.xlEdgeBottom].LineStyle = Excel.XlLineStyle.xlContinuous; sheet.Range["C5", "E10"].Borders[Excel.XlBordersIndex.xlInsideHorizontal].LineStyle = Excel.XlLineStyle.xlContinuous; sheet.Range["C5", "E10"].Borders[Excel.XlBordersIndex.xlInsideVertical].LineStyle = Excel.XlLineStyle.xlContinuous; sheet.Range["B2", "F11"].Borders[Excel.XlBordersIndex.xlEdgeLeft].Weight = Excel.XlBorderWeight.xlMedium; sheet.Range["B2", "F11"].Borders[Excel.XlBordersIndex.xlEdgeTop].Weight = Excel.XlBorderWeight.xlMedium; sheet.Range["B2", "F11"].Borders[Excel.XlBordersIndex.xlEdgeRight].Weight = Excel.XlBorderWeight.xlMedium; sheet.Range["B2", "F11"].Borders[Excel.XlBordersIndex.xlEdgeBottom].Weight = Excel.XlBorderWeight.xlMedium; sheet.Range["C5", "E10"].Borders[Excel.XlBordersIndex.xlEdgeLeft].Weight = Excel.XlBorderWeight.xlThin; sheet.Range["C5", "E10"].Borders[Excel.XlBordersIndex.xlEdgeTop].Weight = Excel.XlBorderWeight.xlThin; sheet.Range["C5", "E10"].Borders[Excel.XlBordersIndex.xlEdgeRight].Weight = Excel.XlBorderWeight.xlThin; sheet.Range["C5", "E10"].Borders[Excel.XlBordersIndex.xlEdgeBottom].Weight = Excel.XlBorderWeight.xlThin; sheet.Range["C5", "E10"].Borders[Excel.XlBordersIndex.xlInsideHorizontal].Weight = Excel.XlBorderWeight.xlThin; sheet.Range["C5", "E10"].Borders[Excel.XlBordersIndex.xlInsideVertical].Weight = Excel.XlBorderWeight.xlThin; #endregion #region Merge & Font 정의 sheet.Range["C3", "E10"].Font.Name = "맑은 고딕"; sheet.Range["C5", "E10"].Font.Size = 11; sheet.Range["C3", "E3"].Font.Size = 18; sheet.Range["C3", "E10"].HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter; sheet.Range["C3", "E10"].VerticalAlignment = Excel.XlVAlign.xlVAlignCenter; sheet.Range["D8", "E8"].HorizontalAlignment = Excel.XlHAlign.xlHAlignLeft; sheet.Range["D8", "E8"].VerticalAlignment = Excel.XlVAlign.xlVAlignTop; sheet.Range["C3", "E3"].Merge(); sheet.Range["D5", "E5"].Merge(); sheet.Range["D6", "E6"].Merge(); sheet.Range["D7", "E7"].Merge(); sheet.Range["D8", "E8"].Merge(); sheet.Range["D9", "E9"].Merge(); #endregion #region 내용 입력 sheet.Cells[3, 3] = "장비 Assign 요청서"; sheet.Cells[5, 3] = "일 시"; sheet.Cells[6, 3] = "장 소"; sheet.Cells[7, 3] = "대 상"; sheet.Cells[8, 3] = "목 적"; sheet.Cells[9, 3] = "출입인원"; sheet.Cells[10, 3] = "주 관"; TimeSpan delay = CalEndTm.Value - CalStartTm.Value; string strTime = CalStartTm.Value.ToString("yyyy년 MM월 dd일 HH:mm") + " ~ "; if (delay.Days < 1) { strTime += CalEndTm.Value.ToString("HH:mm"); } else { strTime += CalEndTm.Value.ToString("yyyy년 MM월 dd일 HH:mm"); } strTime += " (" + delay.Hours.ToString() + "시간"; if (delay.Minutes > 0) { strTime += " " + delay.Minutes.ToString() + "분"; } strTime += ")"; sheet.Cells[5, 4] = strTime; sheet.Cells[6, 4] = txtSite.Text; sheet.Cells[7, 4] = txtProduct.Text; sheet.Cells[8, 4] = txtDesc.Text; cbo.SetItemChecked(cbockVisitUser.ValueList); sheet.Cells[9, 4] = cbo.Text.Trim(); sheet.Cells[10, 4] = "(주)MYC"; cbo.SetItemChecked(cboCstUser.ValueList); sheet.Cells[10, 5] = cboComp.Text.Substring(cboComp.Text.IndexOf(']') + 1).Trim() + ":" + cbo.Text.Trim(); FileInfo file = new FileInfo(path); if (file.Exists) { file.Delete(); } work.SaveAs(path, Excel.XlFileFormat.xlWorkbookDefault); work.Close(); app.Quit(); System.Diagnostics.Process.Start(path); #endregion } catch (Exception ex) { ViewMessage.Error(ex.Message); } }
private void InitControls() { cboComp.Params.Add("strCompType", "C"); cboComp.BindDataSet(); CheckComboBox cbo = new CheckComboBox() { Sql = "CommonSearch#getUserList" }; cbo.Params.Clear(); cbo.Params.Add("strCompType", "M,C,V"); cbo.BindDataSet(); _dtUser = cbo.DataSource; cbo = new CheckComboBox() { Sql = "CommonSearch#getCompList" }; cbo.Params.Clear(); cbo.Params.Add("strCompType", "M,C,V"); cbo.BindDataSet(); _dtComp = cbo.DataSource; cbo = new CheckComboBox() { Sql = "CommonSearch#getModelList" }; cbo.Params.Clear(); cbo.Params.Add("strModel", ""); cbo.BindDataSet(); _dtModel = cbo.DataSource; cbo = new CheckComboBox() { Sql = "CommonSearch#getCommonItems" }; cbo.Params.Clear(); cbo.Params.Add("strItem", "EQP_STATUS"); cbo.BindDataSet(); _dtStatus = cbo.DataSource; cbo = new CheckComboBox() { Sql = "CommonSearch#getVerList" }; cbo.Params.Clear(); cbo.Params.Add("strModel", ""); cbo.BindDataSet(); _dtVer = cbo.DataSource; cbo = new CheckComboBox() { Sql = "CommonSearch#getManagerCode" }; cbo.Params.Clear(); cbo.Params.Add("strCompCode", ""); cbo.BindDataSet(); _dtMgrCode = cbo.DataSource; DataRow nr = _dtMgrCode.NewRow(); nr["ITEM_CD"] = ""; nr["ITEM_NM"] = "(선택없음)"; _dtMgrCode.Rows.Add(nr); }