Exemplo n.º 1
0
    public void SetInterfaceGrid()
    {
        Biz_Bsc_Interface_Kpi_Query objQry = new Biz_Bsc_Interface_Kpi_Query(this.IKpiRefID, "");

        this.IDiCode = objQry.IDicode;

        if (this.IDiCode == "")
        {
            ltrScript.Text = JSHelper.GetAlertScript("정의된 Interface가 없습니다.", false);
            return;
        }

        Biz_Bsc_Interface_Column objCol = new Biz_Bsc_Interface_Column();
        DataSet rDs = objCol.GetAllList(this.IDiCode, gUserInfo.Emp_Ref_ID);

        int    iRow      = 0;
        string sUseYn    = "N";
        string sColKey   = "";
        string sColName  = "";
        int    iDPoints  = 0;
        int    iGridWith = 0;

        UltraGridColumn ugCol;

        if (rDs.Tables.Count > 0)
        {
            iRow = rDs.Tables[0].Rows.Count;
            if (iRow > 0)
            {
                ugCol                           = new UltraGridColumn();
                ugCol.Key                       = "TRX_DATE";
                ugCol.BaseColumnName            = "TRX_DATE";
                ugCol.Header.Caption            = "발생일자";
                ugCol.Width                     = Unit.Pixel(100);
                ugCol.AllowUpdate               = AllowUpdate.Yes;
                ugCol.DataType                  = "System.String";
                ugCol.CellStyle.HorizontalAlign = HorizontalAlign.Left;
                ugrdInterface.Columns.Add(ugCol);

                for (int i = 0; i < iRow; i++)
                {
                    sUseYn    = rDs.Tables[0].Rows[i]["USE_YN"].ToString();
                    sColKey   = rDs.Tables[0].Rows[i]["COLUMN_ID"].ToString();
                    sColName  = rDs.Tables[0].Rows[i]["COLUMN_ALIAS"].ToString();
                    iDPoints  = Convert.ToInt32(rDs.Tables[0].Rows[i]["DECIMAL_POINTS"].ToString());
                    iGridWith = Convert.ToInt32(rDs.Tables[0].Rows[i]["GRID_WIDTH"].ToString());
                    if (sUseYn == "Y")
                    {
                        if (sColKey.Substring(0, 7) == "SVALUES")
                        {
                            ugCol                           = new UltraGridColumn();
                            ugCol.Key                       = sColKey;
                            ugCol.BaseColumnName            = sColKey;
                            ugCol.Header.Caption            = sColName;
                            ugCol.Width                     = Unit.Pixel(iGridWith);
                            ugCol.DataType                  = "System.String";
                            ugCol.AllowUpdate               = AllowUpdate.Yes;
                            ugCol.CellStyle.HorizontalAlign = HorizontalAlign.Left;
                            ugrdInterface.Columns.Add(ugCol);
                        }
                        else
                        {
                            ugCol                           = new UltraGridColumn();
                            ugCol.Key                       = sColKey;
                            ugCol.BaseColumnName            = sColKey;
                            ugCol.Header.Caption            = sColName;
                            ugCol.Width                     = Unit.Pixel(iGridWith);
                            ugCol.AllowUpdate               = AllowUpdate.Yes;
                            ugCol.DataType                  = "System.Double";
                            ugCol.Format                    = "#,###,###,###,###,###,###,##0" + this.GetFormatPoints(iDPoints);
                            ugCol.CellStyle.HorizontalAlign = HorizontalAlign.Right;
                            ugrdInterface.Columns.Add(ugCol);
                        }
                    }
                }
            }
        }

        string  sRtnMsg    = "";
        bool    bIsSuccess = false;
        decimal dRtnVal    = 0;
        DataSet rDsQry     = objQry.GetInterfaceData(this.IKpiRefID, this.IYMD, out sRtnMsg, out bIsSuccess);

        ugrdInterface.Clear();
        ugrdInterface.DataSource = rDsQry;
        ugrdInterface.DataBind();

        //dRtnVal = objQry.GetInterfaceResultMs(this.IKpiRefID, this.IYMD, out sRtnMsg, out bIsSuccess);
        //txtResult_Ms.Text = (bIsSuccess) ? dRtnVal.ToString() : "0";

        //dRtnVal = objQry.GetInterfaceResultTs(this.IKpiRefID, this.IYMD.Substring(0,4)+"01", this.IYMD, out sRtnMsg, out bIsSuccess);
        //txtResult_Ts.Text = (bIsSuccess) ? dRtnVal.ToString() : "0";
    }
Exemplo n.º 2
0
    public void SetPreviewGrid()
    {
        Biz_Bsc_Interface_Column objCol = new Biz_Bsc_Interface_Column();
        DataSet rDs = objCol.GetAllList(this.IDiCode, gUserInfo.Emp_Ref_ID);

        int    iRow      = 0;
        string sUseYn    = "N";
        string sColKey   = "";
        string sColName  = "";
        int    iDPoints  = 0;
        int    iGridWith = 0;

        UltraGridColumn ugCol;

        if (rDs.Tables.Count > 0)
        {
            iRow = rDs.Tables[0].Rows.Count;
            if (iRow > 0)
            {
                ugCol                           = new UltraGridColumn();
                ugCol.Key                       = "YMD";
                ugCol.BaseColumnName            = "YMD";
                ugCol.Header.Caption            = "평가월";
                ugCol.Width                     = Unit.Pixel(50);
                ugCol.AllowUpdate               = AllowUpdate.No;
                ugCol.DataType                  = "System.String";
                ugCol.CellStyle.HorizontalAlign = HorizontalAlign.Center;
                ugrdPreview.Columns.Add(ugCol);

                ugCol                           = new UltraGridColumn();
                ugCol.Key                       = "DD";
                ugCol.BaseColumnName            = "DD";
                ugCol.Header.Caption            = "발생일자";
                ugCol.Width                     = Unit.Pixel(35);
                ugCol.AllowUpdate               = AllowUpdate.Yes;
                ugCol.DataType                  = "System.String";
                ugCol.Header.Style.Wrap         = true;
                ugCol.CellStyle.HorizontalAlign = HorizontalAlign.Center;
                ugrdPreview.Columns.Add(ugCol);

                for (int i = 0; i < iRow; i++)
                {
                    sUseYn    = rDs.Tables[0].Rows[i]["USE_YN"].ToString();
                    sColKey   = rDs.Tables[0].Rows[i]["COLUMN_ID"].ToString();
                    sColName  = rDs.Tables[0].Rows[i]["COLUMN_ALIAS"].ToString();
                    iDPoints  = Convert.ToInt32(rDs.Tables[0].Rows[i]["DECIMAL_POINTS"].ToString());
                    iGridWith = Convert.ToInt32(rDs.Tables[0].Rows[i]["GRID_WIDTH"].ToString());
                    if (sUseYn == "Y")
                    {
                        if (sColKey.Substring(0, 7) == "SVALUES")
                        {
                            ugCol                           = new UltraGridColumn();
                            ugCol.Key                       = sColKey;
                            ugCol.BaseColumnName            = sColKey;
                            ugCol.Header.Caption            = sColName;
                            ugCol.Width                     = Unit.Pixel(iGridWith);
                            ugCol.DataType                  = "System.String";
                            ugCol.AllowUpdate               = AllowUpdate.Yes;
                            ugCol.CellStyle.HorizontalAlign = HorizontalAlign.Left;
                            ugrdPreview.Columns.Add(ugCol);
                        }
                        else
                        {
                            ugCol                           = new UltraGridColumn();
                            ugCol.Key                       = sColKey;
                            ugCol.BaseColumnName            = sColKey;
                            ugCol.Header.Caption            = sColName;
                            ugCol.Width                     = Unit.Pixel(iGridWith);
                            ugCol.AllowUpdate               = AllowUpdate.Yes;
                            ugCol.DataType                  = "System.Double";
                            ugCol.Format                    = "#,###,###,###,###,###,###,##0" + this.GetFormatPoints(iDPoints);
                            ugCol.CellStyle.HorizontalAlign = HorizontalAlign.Right;
                            ugrdPreview.Columns.Add(ugCol);
                        }
                    }
                }
            }
        }

        Biz_Bsc_Term_Detail objTerm = new Biz_Bsc_Term_Detail();
        string sEstMon = objTerm.GetReleasedMonth();

        Random rndObj = new Random();

        for (int i = 0; i < 11; i++)
        {
            ugrdPreview.Rows.Add();
            for (int j = 0; j < ugrdPreview.Columns.Count; j++)
            {
                if (ugrdPreview.Columns[j].DataType == "System.String")
                {
                    if (ugrdPreview.Columns[j].Key == "YMD")
                    {
                        ugrdPreview.Rows[i].Cells.FromKey(ugrdPreview.Columns[j].Key).Value = sEstMon;
                    }
                    else if (ugrdPreview.Columns[j].Key == "DD")
                    {
                        ugrdPreview.Rows[i].Cells.FromKey(ugrdPreview.Columns[j].Key).Value = Convert.ToString(rndObj.Next(1, 31)).PadLeft(2, '0');
                    }
                    else
                    {
                        ugrdPreview.Rows[i].Cells.FromKey(ugrdPreview.Columns[j].Key).Value = "String" + i.ToString();
                    }
                }
                else if (ugrdPreview.Columns[j].DataType == "System.Date")
                {
                    ugrdPreview.Rows[i].Cells.FromKey(ugrdPreview.Columns[j].Key).Value = DateTime.Now;
                }
                else if (ugrdPreview.Columns[j].DataType == "System.Double")
                {
                    ugrdPreview.Rows[i].Cells.FromKey(ugrdPreview.Columns[j].Key).Value = rndObj.NextDouble() * rndObj.Next(1000, 1000000);
                }
            }
        }

        ugrdPreview.Visible = true;
    }
Exemplo n.º 3
0
    public void ExportExcelFormat()
    {
        Biz_Bsc_Interface_Kpi_Query objQry = new Biz_Bsc_Interface_Kpi_Query(this.IKpiRefID, "");
        DataSet rDsQry = objQry.GetInterfaceData(this.IKpiRefID, this.IYMD, out sRtnMsg, out bIsSuccess);

        int iCntCol = 0;

        if (rDsQry.Tables.Count > 0)
        {
            if (rDsQry.Tables[0].Rows.Count > 0)
            {
                iCntCol = rDsQry.Tables[0].Columns.Count;
            }
            else
            {
                iCntCol = 0;
            }
        }

        ExcelEngine  xlsEngine = new ExcelEngine();
        IApplication xlsApp    = xlsEngine.Excel;

        IWorkbook  xlsBook  = xlsEngine.Excel.Workbooks.Create(1);
        IWorksheet xlsSheet = xlsBook.Worksheets[0];

        try
        {
            int iCol = WebCommon.GetExcelColumnCount();

            for (int i = iCol; i > iCntCol; i--)
            {
                xlsSheet.ShowColumn(i, false);
            }

            Biz_Bsc_Interface_Column objCol = new Biz_Bsc_Interface_Column();
            string sColNm = "";
            for (int i = 0; i < iCntCol; i++)
            {
                sColNm = rDsQry.Tables[0].Columns[i].ColumnName;
                objCol = new Biz_Bsc_Interface_Column(this.IDiCode, sColNm, gUserInfo.Emp_Ref_ID);

                if (i == 0)
                {
                    xlsSheet.Range[1, i + 1].Text        = sColNm;
                    xlsSheet.Range[2, i + 1].Text        = "발생일자";
                    xlsSheet.Range[2, i + 1].ColumnWidth = 10;
                }
                else
                {
                    xlsSheet.Range[1, i + 1].Text        = objCol.IColumn_Id;
                    xlsSheet.Range[2, i + 1].Text        = objCol.IColumn_Alias;
                    xlsSheet.Range[2, i + 1].ColumnWidth = (objCol.IGrid_Width / 9);
                    xlsSheet.Columns[i].AutofitColumns();
                    xlsSheet.Columns[i].AutofitRows();
                }

                //switch (rDsQry.Tables[0].Columns[i].DataType.Name.ToLower())
                //{
                //    case "decimal":
                //        string sChar  = WebCommon.GetExcelColumnName(i);
                //        string sRange = sChar + "3:" + sChar + "10000";
                //        IDataValidation dvColumn    = xlsSheet.Range[sRange].DataValidation;
                //        xlsSheet.Range[sRange].Text = "";
                //        xlsSheet.Range[sRange].NumberFormat = "#,###,###,###,###,###,###,###,###,###,##0.0######";
                //        xlsSheet.Range[sRange].AutofitColumns();

                //        dvColumn.AllowType          = ExcelDataType.Decimal;
                //        dvColumn.CompareOperator    = ExcelDataValidationComparisonOperator.Between;
                //        dvColumn.FirstFormula       = System.Decimal.MinValue.ToString();
                //        dvColumn.SecondFormula      = System.Decimal.MaxValue.ToString();
                //        dvColumn.ShowErrorBox       = true;
                //        dvColumn.ErrorBoxText       = "Enter Value between " + System.Decimal.MinValue.ToString() + " to " + System.Decimal.MaxValue.ToString();
                //        dvColumn.ErrorBoxTitle      = "ERROR";
                //        dvColumn.PromptBoxText      = "Data Validation using Condition for Numbers";
                //        dvColumn.ShowPromptBox      = true;
                //        break;
                //    default:
                //        break;
                //}
            }

            string sFileName = "InterfaceData" + "_" + this.IKpiRefID + "_" + this.IYMD + ".xls";

            xlsSheet.ShowRow(1, false);

            //Saving the workbook to disk.
            xlsBook.SaveAs(sFileName, ExcelSaveType.SaveAsXLS, Response, ExcelDownloadType.PromptDialog);
        }
        catch (Exception e)
        {
            ltrScript.Text = JSHelper.GetAlertScript(e.Message);
        }
        finally
        {
            xlsEngine.ThrowNotSavedOnDestroy = false;
            xlsEngine.Dispose();
        }



        //Entering text inside the Cells


        //sheet.Range["A1:D1"].Text = "This is the Long Text";
        //sheet.Range["E1"].Text = "This is the Long Text";
        //sheet.Range["A2:A5"].Text = "This is the Long Text using Autofit Columns and Rows";

        ////AutoFit Applied to a Range
        //sheet.Range["A1:D1"].AutofitColumns();
        //sheet.Range["A2:A5"].AutofitRows();

        ////AutoFit applied to a Single Column
        //sheet.AutofitColumn(5);
        ////AutoFit applied to a Single Row
        //sheet.AutofitRow(1);

        ////Saving the workbook to disk.
        //workbook.SaveAs("Sample.xls", ExcelSaveType.SaveAsXLS, Response, ExcelDownloadType.PromptDialog);
        ////No exception will be thrown if there are unsaved workbooks.
        //excelEngine.ThrowNotSavedOnDestroy = false;
        //excelEngine.Dispose();
    }
Exemplo n.º 4
0
    /// <summary>
    /// 조회필드 조건필드 설정
    /// </summary>
    public void SetColumnList()
    {
        Biz_Bsc_Interface_Column objCol = new Biz_Bsc_Interface_Column();
        DataSet rDs = objCol.GetAllList(this.IDiCode, gUserInfo.Emp_Ref_ID);

        lstField.Items.Clear();
        lstCondition.Items.Clear();
        lstListField.Items.Clear();

        // Dicode Column 정보 세팅
        if (rDs.Tables.Count > 0)
        {
            int    iRow   = rDs.Tables[0].Rows.Count;
            string sKey   = "";
            string sVal   = "";
            string sUse   = "N";
            bool   bDigit = false;

            for (int i = 0; i < iRow; i++)
            {
                sKey   = rDs.Tables[0].Rows[i]["COLUMN_ID"].ToString();
                sVal   = rDs.Tables[0].Rows[i]["COLUMN_ALIAS"].ToString();
                sUse   = rDs.Tables[0].Rows[i]["USE_YN"].ToString();
                bDigit = (sKey.Substring(0, 7) == "DVALUES") ? true : false;

                if (sUse == "Y" && bDigit)
                {
                    lstField.Items.Add(new ListItem(sVal, sKey));
                    lstCondition.Items.Add(new ListItem(sVal, sKey));
                }
                else if (sUse == "Y" && !bDigit)
                {
                    lstCondition.Items.Add(new ListItem(sVal, sKey));
                }

                lstListField.Items.Add(new ListItem(sVal, sKey));
            }
        }

        // 조건식의 경우 조회조건 파라미터 추가
        if (lstField.Items.Count > 0)
        {
            lstCondition.Items.Add(new ListItem("평가월", "RDTERM"));
            lstCondition.Items.Add(new ListItem("@평가시작월", QueryOperator.ParamFirstYmd));
            lstCondition.Items.Add(new ListItem("@현재평가월", QueryOperator.ParamCurrYmd));
        }

        // 실적데이터 리스트 필드 세팅
        // dicode 정의 후 지표에서 컬럼설정시 정의된 컬럼은 그대로 사용하고 조건식만 변경한다.
        // 즉 같은 dicode를 사용하는 지표의 컬럼은 모두 동일하다
        string sField_Ss = "";
        int    iFRow     = lstListField.Items.Count;

        for (int i = 0; i < iFRow; i++)
        {
            if (i == 0)
            {
                sField_Ss += QueryOperator.LBracket + lstListField.Items[i].Text + QueryOperator.RBracket;
            }
            else
            {
                sField_Ss += ", " + QueryOperator.LBracket + lstListField.Items[i].Text + QueryOperator.RBracket;
            }
        }

        txtField_Ss.Text = sField_Ss;
    }