コード例 #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Getting Query String  Values to Local Variables
            strSettings    = Request.QueryString["ParentName"];
            strDisplayName = Request.QueryString["DisplayName"];
            strMenuKey     = Request.QueryString["MenuKey"];
            NTrustSessionPage.InitializeResources("K2Web.Utility.Integration");
            ExportFile = GetString("ExportFile");
            try
            {
                if (this.hidchkFlag.Value == "Y")
                {
                    this.hidchkFlag.Value = "N";
                    string scriptString = "<script language=JavaScript>";
                    scriptString += "dialogArguments.document.forms[0].hidchkFlag.value='Y';dialogArguments.document.forms[0].submit();";
                    scriptString += " window.close();</script>";
                    this.RegisterStartupScript("Windclose", scriptString);
                }
                if (!this.IsPostBack || hdnSelRow.Value == "true")
                {
                    //string confirm = "return isValid()";
                    //btnExport.Attributes.Add("onclick",confirm);
                    hdnSelRow.Value = "0";
                    InitializePageProperties();
                    FillDelimiter();
                    GetFilterDetails();
                    FillFieldsList();
                    SetDefaultValue();
                }
                //added by Biru to handle session expire problem
                NTrust.Common.Session Sess_user = (NTrust.Common.Session)Session[NTRUST_SESSION];

                NTrust.K2.BO.User ObjUser = (NTrust.K2.BO.User)Sess_user.LoginUser;
                if (ObjUser == null)
                {
                    strRedirectPath = Request.ApplicationPath.ToString() + "/Login.aspx";
                    string strQueryString = "?SE=Y";
                    strQueryString += "&ModalWindow=Y";
                    Response.Redirect(strRedirectPath + strQueryString);
                }                        //End
            }
            catch (NTrust.Util.NTrustException nex)
            {
                ErrExist = "Y";
                lblErrorMessage.Visible = true;
                SetErrorMessage(lblErrorMessage, nex.ErrorCode, nex.Message, ExportFile);
            }
            catch (Exception ex)
            {
                ErrExist = "Y";
                ShowCustomError(0, ex.Message.ToString());
            }
        }
コード例 #2
0
 protected void btnClose_Click(object sender, System.EventArgs e)
 {
     try
     {
         string strScript = "<script language=JavaScript>window.close();</script>";
         this.RegisterStartupScript("Wiclose", strScript);
     }
     catch (NTrust.Util.NTrustException nex)
     {
         ErrExist = "Y";
         lblErrorMessage.Visible = true;
         NTrustSessionPage.InitializeResources("K2Web.Utility.Integration");
         SetErrorMessage(lblErrorMessage, nex.ErrorCode, nex.Message, GetString("ExportFile"));
     }
     catch (Exception ex)
     {
         ErrExist = "Y";
         ShowCustomError(0, ex.Message.ToString());
     }
 }
コード例 #3
0
 protected void udgFieldList_DataBound(Object sender, EventArgs e)
 {
     NTrustSessionPage.InitializeResources("K2Web.Utility.Integration");
     udgFieldList.Columns[0].HeaderText = NTrustSessionPage.GetString("FieldName");
     udgFieldList.Columns[1].HeaderText = NTrustSessionPage.GetString("FieldLength");
 }
コード例 #4
0
        /*
         * ----------------------------------------------------------------------------------------------------
         * Synopsis		:	This Method will EXPORT the Data  to a TEXT FILE
         * Input			:
         * Output			:
         * -----------------------------------------------------------------------------------------------------
         */
        protected void btnExport_Click(object sender, System.EventArgs e)
        {
            bool blnWriteFlag = false;

            string[] strSQLScript = new string[4];
            try
            {
                NTrust.K2.BO.Export objExport = (NTrust.K2.BO.Export)NTrustSession.CreateBusinessObject("AEXPORT", 1);
                NTrust.K2.BO.Export.ExportFieldStruct ExpFldStruct = new  NTrust.K2.BO.Export.ExportFieldStruct();

                string strPKEY      = ddlNamedFilter.SelectedValue;
                string strDelimiter = this.ddlDelimiter.SelectedValue;
                string strFilePath  = this.txtSelectedFile.Text;

                bool blnOpenOrOverWrite = (this.chkAppend.Checked == true)?true:false;

                string strFilter = "";

                /*
                 *      if (this.chkSave.Checked )
                 *      {
                 *              // Here Deleting the Demlimiter Record
                 *              strFilter		= "varname='" + DELIMITCHAR + "'";
                 *              strSQLScript[0] = "DELETE FROM Y_VARIABLES WHERE " + strFilter ;
                 *              // Here Deleting the Export File Directory Record
                 *              strFilter		= "varname='" + EXPORTDIRECTORY + "'";
                 *              strSQLScript[1] = "DELETE FROM Y_VARIABLES WHERE " + strFilter ;
                 *              // Here Forming the Insert Script for the Demlimiter Record
                 *              ExpFldStruct.strTemplateName	= "";
                 *              ExpFldStruct.strValue1		= strDelimiter;
                 *              ExpFldStruct.strValue2		= "";
                 *              ExpFldStruct.strValue3		= "";
                 *              ExpFldStruct.strVarName		= DELIMITCHAR;
                 *              ExpFldStruct.strValueDate	= "";
                 *              ExpFldStruct.strSeqence		= "0";
                 *              strSQLScript[2] = objExport.GenInsExportFieldsSetting(ExpFldStruct);
                 *
                 *      // Here Forming the Insert Script for the  Export File Directory Record
                 *              ExpFldStruct.strTemplateName	= "";
                 *              ExpFldStruct.strValue1		= strFilePath;
                 *              ExpFldStruct.strValue2		= "";
                 *              ExpFldStruct.strValue3		= "";
                 *              ExpFldStruct.strVarName		= EXPORTDIRECTORY;
                 *              ExpFldStruct.strValueDate	= "";
                 *              ExpFldStruct.strSeqence		= "0";
                 *              strSQLScript[3] = objExport.GenInsExportFieldsSetting(ExpFldStruct);
                 *              // Here Execution the Script  Both Deleting and Inserting in a Single Transaction
                 *              objExport.AddExportFieldsSetting(strSQLScript);
                 *
                 *      }
                 *
                 *      // Here Getting the Template details
                 *      NTrust.K2.BO.ExportManager   ObjExpMan = null;
                 *      ObjExpMan		= (NTrust.K2.BO.ExportManager) NTrustSession.CreateBusinessObject("ExportManager", 1);
                 *      strFilter		= "varname ='"+ FIELDSETTINGS +"' and VALUE_FKEY='"+strPKEY +"'";
                 *      strSort			= SELECT_FIELDVALUE;
                 *      DataTable dtExportResult = ObjExpMan.GetExportVariable(strFilter,strSort);
                 *
                 */
                NTrust.K2.BO.ExportManager ObjExpMan = null;
                ObjExpMan = (NTrust.K2.BO.ExportManager)NTrustSession.CreateBusinessObject("ExportManager", 1);
                // Here forming the Select Statement Based on the Template Selected
                int [] intSize = new int[50];
                intSize[0] = 8;
                intSize[1] = 20;
                intSize[2] = 8;
                intSize[3] = 11;
                intSize[4] = 8;
                intSize[5] = 8;
                intSize[6] = 30;

                string strQuery = "SELECT * FROM V_K2_EXPORTJOURNALFIELDSCOCOS";
                strQuery += " ORDER BY PARENT_ID,GLCODE,VENDOR_NUMBER,DUE_DATE,CHECK_KEY";

                if (strFilePath != "")
                {
                    //Cocos Result data to Text File
                    strDelimiter = ",";                   // For CSV file.

                    string strpath      = System.Configuration.ConfigurationSettings.AppSettings[SAVE_FILE_PATH] + ADD_FILE_PATH;
                    bool   folderExists = Directory.Exists(strpath);
                    if (!folderExists)
                    {
                        Directory.CreateDirectory(strpath);
                    }
                    strFilePath  = strpath + strFilePath;
                    blnWriteFlag = ObjExpMan.ExportToCOCOSFile(strQuery, strDelimiter, strFilePath, blnOpenOrOverWrite, intSize);
                    if (blnWriteFlag)
                    {
                        string url = "";//changes made for CR - Journal Accrual Export for not to update Accrual Records. by Biru
                        if (chkExportLocal.Checked)
                        {
                            url = "JounralExportMessage.aspx?ParentName=" + strSettings + "&DisplayName=" + strDisplayName + "&MenuKey=" + strMenuKey + "&ExportType=" + strExportType + "&FileName=" + txtSelectedFile.Text + "";
                        }
                        else
                        {
                            url = "JounralExportMessage.aspx?ParentName=" + strSettings + "&DisplayName=" + strDisplayName + "&MenuKey=" + strMenuKey + "&ExportType=" + strExportType + "&FileName=";
                        }
                        string strScript = "<script language=JavaScript>window.showModalDialog('" + url + "',window,'status:no;dialogWidth:465px;dialogHeight:175px;');</script>";
                        this.RegisterStartupScript("Winclose", strScript);
                    }
                    else
                    {
                        NTrustSessionPage.InitializeResources("K2Web.CommonResource");
                        this.CreateMessageAlert(this, GetString("NoRectoExportExcel"));
                    }
                }
            }


            catch (NTrust.Util.NTrustException nex)
            {
                if (nex.ErrorCode == 500000)
                {
                    ErrExist = "Y";
                    lblErrorMessage.Visible = true;
                    NTrustSessionPage.InitializeResources("K2Web.Utility.Integration");
                    CreateMessageAlert(this, GetString("FileAccess"));
                    //lblErrorMessage.Text    = "File is accessed by Another Process. Close the file and export again";
                }
                else
                {
                    ErrExist = "Y";
                    lblErrorMessage.Visible = true;
                    NTrustSessionPage.InitializeResources("K2Web.Utility.Integration");
                    SetErrorMessage(lblErrorMessage, nex.ErrorCode, nex.Message, GetString("Export File"));
                }
            }
            catch (System.IO.FileNotFoundException Ferr)
            {
                ErrExist = "Y";
                lblErrorMessage.Visible = true;
                SetErrorMessage(lblErrorMessage, 0, Ferr.Message.ToString(), "");
            }
            catch (Exception ex)
            {
                ErrExist = "Y";
                ShowCustomError(0, ex.Message.ToString());
            }
        }