Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="RLOC"></param>
        /// <returns></returns>
        public bool FindEticketRecords(string RLOC)
        {
            bool   rv      = false;
            String GetTick = "";

            if (Request.QueryString["ET"] != null)
            {
                GetTick = Request.QueryString["ET"].ToString();
            }
            try
            {
                string strFormName = "";
                if (m_GDS == "AU")
                {
                    strFormName = "AXQIETICKETAUD";
                }
                else if (m_GDS == "SG")
                {
                    strFormName = "AXQIETICKET";
                }
                else if (m_GDS == "IN")
                {
                    strFormName = "AXQIETICKETINR";
                }

                DataSet                 m_ProcessPNRsDS     = new DataSet();
                MailRecordsBAL          objMailRecordsBAL   = new MailRecordsBAL("");
                List <MailRecordsModel> lstMailRecordsModel = objMailRecordsBAL.FindEticketRecords(RLOC, GetTick, strFormName);
                DataTable               dt = Common.ListToDataTable(lstMailRecordsModel);
                m_ProcessPNRsDS.Tables.Add(dt);

                // check if the record exist already
                //if (m_ProcessPNRsDS.Tables != null && m_ProcessPNRsDS.Tables.Count != 0 && m_ProcessPNRsDS.Tables[0].Rows != null)
                //    return rv;

                string Created     = "";
                string Subject     = "";
                string LastSubject = "LastSubject";

                foreach (DataRow myRow in m_ProcessPNRsDS.Tables[0].Rows)
                {
                    string FormName = myRow["FormName"].ToString();

                    if (myRow["Created"].ToString() == Created && LastSubject == Subject)
                    {
                        // must be a copy record
                        continue;
                    }

                    Subject = myRow["Subject"].ToString();
                    if (FormName.ToUpper().IndexOf("QIETICKET") != -1)
                    {
                        Created     = myRow["Created"].ToString();
                        LastSubject = Subject;

                        // look for matching surname
                        Match Ma = Regex.Match(Subject, GetNameCommand());

                        if (!Ma.Success)
                        {
                            continue;
                        }

                        string[] Names;
                        if (Ma.Groups["detail"].ToString().IndexOf("_") != -1)
                        {
                            Names = Ma.Groups["detail"].ToString().Split('_');
                        }
                        else
                        {
                            Names = Ma.Groups["detail"].ToString().Split('/');
                        }

                        string newName = Names[0].Trim();

                        if (newName == m_Surname)
                        {
                            if (myRow["FileName"] == null || myRow["FileName"].ToString().Length == 0)
                            {
                                continue;
                            }

                            string FileName = myRow["FileName"].ToString().ToUpper();
                            // now retrieve the doc and place it in the temp folder.
                            if (GetTransaction(ref FileName, myRow["TicketNumber"].ToString()))
                            {
                                Dictionary <string, string> dictionary = new Dictionary <string, string>();
                                dictionary.Add("c:/Temp/" + Path.GetFileName(FileName), myRow["Subject"].ToString());

                                var selectList = new SelectList(dictionary, "Key", "Value");
                                ViewData["ETicket"] = selectList;

                                //ListItem item = new ListItem(myRow["Subject"].ToString() + " ", "temp/" + Path.GetFileName(FileName));  //Need To Work
                                //DropDownList1.Items.Add(item);
                                if (GetTick.Length > 0)
                                {
                                    Session["output"] = "c:/Temp/" + Path.GetFileName(FileName);
                                    return(true);
                                    //Response.Redirect("temp/" + Path.GetFileName(FileName), true);
                                }
                            }
                            rv = true;
                        }
                    }
                }

                m_ProcessPNRsDS.Dispose();
                GC.Collect();
                return(rv);
            }
            catch (InvalidOperationException ioExp)
            {
                m_LastError += "InvalidOperationException in FindMailrecords " + m_RLOC + " : " + ioExp.Message + "\r\n";
                System.Diagnostics.Trace.WriteLine(ioExp.Message);
            }
            catch (MySqlException oleExp)
            {
                m_LastError += "MySqlException in FindMailrecords " + m_RLOC + " : " + oleExp.Message + "\r\n";
                System.Diagnostics.Trace.WriteLine(oleExp.Message);
            }
            catch (Exception e)
            {
                m_LastError += "Exception in FindMailrecords " + m_RLOC + " : " + e.Message + "\r\n";
                System.Diagnostics.Trace.WriteLine(e.Message);
            }

            return(rv);
        }