public DataTable CloseConnections()
        {
            clsLog    oLog  = new clsLog();
            DataTable table = null;

            try
            {
                //if (this.TryConnection())
                //{
                oLog.WriteToDebugLogFile("executing Procedure", "CloseConnection");
                DatabaseParameters parameters = new DatabaseParameters();
                CurSQLFactory.ExecuteStoredProcedure(this.DataStructrure.StoredProcedures.closeConnections.ActualTableName, parameters);
                table = CurDBEngine.SelectQuery(CurSQLFactory.SQL);
                if (table == null)
                {
                    error_occured = true;
                    ErrMsg        = "[SwordfishManagerBase] : CloseConnections : " + CurDBEngine.ErrorMessage;
                }
                return(table);
                //}
                //error_occured = true;
                //ErrMsg = "[SwordfishManagerBase] : CloseConnections : " + ErrMsg;
            }
            catch (Exception ex)
            {
                oLog.WriteToErrorLogFile(ex.Message.ToString(), "CloseConnection");
            }

            return(table);
        }
Beispiel #2
0
    public string DownloadMasterUsersByJSON(DateTime dtCreated)
    {
        UploadManager CurUploadManager = new UploadManager();
        clsLog        oLog             = new clsLog();

        oLog.WriteToDebugLogFile("Starting Function", "DownloadMasterUsersByJSON");
        ApplicationUserCollection UserCollection = CurUploadManager.DownloadMasterUsersInColl(dtCreated);
        // DataTable objDataSet = CurUploadManager.DownloadMasterUsers(dtCreated);
        // Create a multidimensional jagged array
        // string[][] JaggedArray = new string[objDataSet.Rows.Count][];
        // int i = 0;
        // foreach (DataRow rs in objDataSet.Rows)
        //  {
        //JaggedArray[i] = new string[] { rs["user_id"].ToString(), rs["user_password"].ToString(), rs["user_firstname"].ToString() };
        // i = i + 1;
        //user.FirstName = ;
        // }

        // Return JSON data


        string json = JsonConvert.SerializeObject(UserCollection);

        return(json);
    }
        protected virtual bool TryConnection()
        {
            CloseConnections();
            clsLog oLog = new clsLog();

            try
            {
                if (!this.is_ready)
                {
                    this.CurDBEngine = new DatabaseEngine(base.PrivateConfig.DatabaseType, base.PrivateConfig.DatabaseConnectionString);
                    if (this.CurDBEngine.Connect())
                    {
                        this.is_ready = true;
                        oLog.WriteToDebugLogFile("Connected", "TryConnection");
                    }
                    else
                    {
                        this.error_occured = true;
                        base.ErrMsg        = this.CurDBEngine.ErrorMessage;
                    }
                }
            }
            catch (Exception exception)
            {
                this.error_occured = true;
                base.ErrMsg        = exception.Message;
            }
            return(this.is_ready);
        }
Beispiel #4
0
    public string DownloadMasterCheckListType(DateTime dtCreated)
    {
        clsLog oLog = new clsLog();

        oLog.WriteToDebugLogFile("Starting Function", "DownloadMasterCheckListType");
        UploadManager CurUploadManager = new UploadManager();
        MasterCheckListTypeCollection masterCheckListTypeColleaction = CurUploadManager.DownloadMasterCheckListType(dtCreated);
        string json = JsonConvert.SerializeObject(masterCheckListTypeColleaction);

        return(json);
    }
Beispiel #5
0
    public string DownloadQuickNotes()
    {
        clsLog oLog = new clsLog();

        oLog.WriteToDebugLogFile("Starting Function", "DownloadQuickNotes");
        UploadManager CurUploadManager = new UploadManager();
        MasterQuickNotesCollection quickNotesCollection = CurUploadManager.DownloadQuickNotes();
        string json = JsonConvert.SerializeObject(quickNotesCollection);

        return(json);
    }
Beispiel #6
0
    public string DownloadMasterLookUp(DateTime dtCreated)
    {
        UploadManager CurUploadManager = new UploadManager();
        clsLog        oLog             = new clsLog();

        oLog.WriteToDebugLogFile("Starting Function", "DownloadMasterLookUp");
        MasterLookUpCollection lookUpCollection = CurUploadManager.DownloadMasterLookUp(dtCreated);
        string json = JsonConvert.SerializeObject(lookUpCollection);

        return(json);
    }
Beispiel #7
0
    public string DownloadMasterCausesByJSON(DateTime dtCreated)
    {
        clsLog oLog = new clsLog();

        oLog.WriteToDebugLogFile("Starting Function", "DownloadMasterCausesByJSON");
        UploadManager         CurUploadManager = new UploadManager();
        MasterCauseCollection CausesCollection = CurUploadManager.DownloadMasterCauses(dtCreated);
        string json = JsonConvert.SerializeObject(CausesCollection);

        return(json);
    }
        public override void Dispose()
        {
            clsLog oLog = new clsLog();

            oLog.WriteToDebugLogFile("Starting Function", "Dispose");
            if (this.is_detroyable)
            {
                oLog.WriteToDebugLogFile("Before Destroy", "Dispose");
                if (this.IsReady)
                {
                    oLog.WriteToDebugLogFile("Before Disconnect", "Dispose");
                    if (CurDBEngine != null)
                    {
                        this.CurDBEngine.Disconnect();
                        oLog.WriteToDebugLogFile("After Disconnect", "Dispose");
                    }
                    else
                    {
                        oLog.WriteToDebugLogFile("DB Engine is Null", "Dispose");
                    }
                }
                this.CurDBEngine   = null;
                this.CurSQLFactory = null;
                oLog.WriteToDebugLogFile("Ending Function", "Dispose");
            }
        }
Beispiel #9
0
    public bool UploadOpNotificationByJSON(string json)
    {
        bool   smooth = true;
        clsLog oLog   = new clsLog();

        oLog.WriteToDebugLogFile("Starting Function", "UploadOpNotificationByJSON");
        WebObjects.obj_notification[] CurOpNotificationCollection = JsonConvert.DeserializeObject <WebObjects.obj_notification[]>(json);

        UploadManager CurUploadManager = new UploadManager();

        smooth = CurUploadManager.UploadOpNotificationCollectionToSQLServer(CurOpNotificationCollection);

        return(smooth);
    }
Beispiel #10
0
        public DataSet Get_InspectionQA_Project(DataSet oDTCompanyList, string sCompany, string sCurrentUserName, string sUserRole)
        {
            DataSet  oDataset  = new DataSet();
            string   sFuncName = string.Empty;
            string   sProcName = string.Empty;
            DataView oDTView   = new DataView();

            try
            {
                sFuncName = "Get_InspectionQA_Project()";
                sProcName = "AE_SP023_Mobile_INSQA_GetProject";
                if (p_iDebugMode == DEBUG_ON)
                {
                    oLog.WriteToDebugLogFile("Starting Function ", sFuncName);
                }

                if (p_iDebugMode == DEBUG_ON)
                {
                    oLog.WriteToDebugLogFile("Calling Run_StoredProcedure() " + sProcName, sFuncName);
                }
                if (oDTCompanyList != null && oDTCompanyList.Tables.Count > 0)
                {
                    oDTView = oDTCompanyList.Tables[0].DefaultView;

                    oDTView.RowFilter = "U_DBName= '" + sCompany + "'";
                    if (oDTView != null && oDTView.Count > 0)
                    {
                        oDataset = SqlHelper.ExecuteDataSet(oDTView[0]["U_ConnString"].ToString(), CommandType.StoredProcedure, sProcName,
                                                            Data.CreateParameter("@Company", sCompany), Data.CreateParameter("@UserName", sCurrentUserName), Data.CreateParameter("@UserRole", sUserRole));

                        if (p_iDebugMode == DEBUG_ON)
                        {
                            oLog.WriteToDebugLogFile("Completed With SUCCESS  ", sFuncName);
                        }
                    }
                    else
                    {
                        if (p_iDebugMode == DEBUG_ON)
                        {
                            oLog.WriteToDebugLogFile("No Data in OUSR table for the selected Company", sFuncName);
                        }
                        return(oDataset);
                    }
                }
                else
                {
                    if (p_iDebugMode == DEBUG_ON)
                    {
                        oLog.WriteToDebugLogFile("There is No Company List in the Holding Company ", sFuncName);
                    }
                    return(oDataset);
                }
                return(oDataset);
            }
            catch (Exception Ex)
            {
                sErrDesc = Ex.Message.ToString();
                oLog.WriteToErrorLogFile(sErrDesc, sFuncName);
                if (p_iDebugMode == DEBUG_ON)
                {
                    oLog.WriteToDebugLogFile("Completed With ERROR  ", sFuncName);
                }
                throw Ex;
            }
        }
Beispiel #11
0
        public DataSet SPA_ValidateUser(string sUserName, string sPassword, string sCategory)
        {
            DataSet  oDataset  = new DataSet();
            string   sFuncName = string.Empty;
            string   sProcName = string.Empty;
            DataView oDTView   = new DataView();

            try
            {
                sFuncName = "SPA_ValidateUser()";
                sProcName = "AE_SPA001_Mobile_ValidateUser";

                if (p_iDebugMode == DEBUG_ON)
                {
                    oLog.WriteToDebugLogFile("Starting Function ", sFuncName);
                }

                if (p_iDebugMode == DEBUG_ON)
                {
                    oLog.WriteToDebugLogFile("Calling Run_StoredProcedure() " + sProcName, sFuncName);
                }


                oDataset = SqlHelper.ExecuteDataSet(ConnectionString, CommandType.StoredProcedure, sProcName,
                                                    Data.CreateParameter("@UserName", sUserName), Data.CreateParameter("@Password", sPassword), Data.CreateParameter("@Category", sCategory));
                if (p_iDebugMode == DEBUG_ON)
                {
                    oLog.WriteToDebugLogFile("Completed With SUCCESS  ", sFuncName);
                }
                if (oDataset.Tables.Count > 0 && oDataset != null)
                {
                    if (p_iDebugMode == DEBUG_ON)
                    {
                        oLog.WriteToDebugLogFile("There is a set of data from the SP :" + sProcName, sFuncName);
                    }
                    return(oDataset);
                }
                else
                {
                    if (p_iDebugMode == DEBUG_ON)
                    {
                        oLog.WriteToDebugLogFile("There is no data from the SP :" + sProcName, sFuncName);
                    }
                    return(oDataset);
                }
            }
            catch (Exception Ex)
            {
                sErrDesc = Ex.Message.ToString();
                oLog.WriteToErrorLogFile(sErrDesc, sFuncName);
                if (p_iDebugMode == DEBUG_ON)
                {
                    oLog.WriteToDebugLogFile("Completed With ERROR  ", sFuncName);
                }
                throw Ex;
            }
        }
Beispiel #12
0
        public DataSet Get_CompanyList()
        {
            DataSet oDataset;
            string  sFuncName = string.Empty;
            string  sProcName = string.Empty;

            try
            {
                sFuncName = "Get_CompanyList()";
                sProcName = "AE_SP001_Mobile_GetCompanyList";
                if (p_iDebugMode == DEBUG_ON)
                {
                    oLog.WriteToDebugLogFile("Starting Function ", sFuncName);
                }

                if (p_iDebugMode == DEBUG_ON)
                {
                    oLog.WriteToDebugLogFile("Calling Run_StoredProcedure() " + sProcName, sFuncName);
                }

                oDataset = SqlHelper.ExecuteDataSet(ConnectionString, CommandType.StoredProcedure, "AE_SP001_Mobile_GetCompanyList");

                if (p_iDebugMode == DEBUG_ON)
                {
                    oLog.WriteToDebugLogFile("Completed With SUCCESS  ", sFuncName);
                }

                return(oDataset);
            }
            catch (Exception Ex)
            {
                sErrDesc = Ex.Message.ToString();
                oLog.WriteToErrorLogFile(sErrDesc, sFuncName);
                if (p_iDebugMode == DEBUG_ON)
                {
                    oLog.WriteToDebugLogFile("Completed With ERROR  ", sFuncName);
                }
                throw Ex;
            }
        }
Beispiel #13
0
        public void GetUserInfo(string sCompany)
        {
            DataTable dtResult = new DataTable();
            string    sResult  = string.Empty;

            try
            {
                oLog.WriteToDebugLogFile("Starting Function", sFuncName);
                //sSQL = string.Format("call \"AE_SP001_UFF_Generation\" ('{0}')", sFileId);
                sSQL = string.Format("call \"AE_SP001_GETALLUSERS\"");

                oLog.WriteToDebugLogFile("Execute SQL" + sSQL, sFuncName);
                OdbcParameter[] Param = new OdbcParameter[0];
                dtResult = oCommon.ExecuteSQLQuery(sSQL, sCompany, Param);
                List <Users> lstUsers = new List <Users>();
                if (dtResult.Rows.Count > 0)
                {
                    foreach (DataRow r in dtResult.Rows)
                    {
                        Users _company = new Users();
                        _company.USERCODE             = r["USERCODE"].ToString();
                        _company.USERNAME             = r["USERNAME"].ToString();
                        _company.DEFAULTENTITY        = r["DEFAULTENTITY"].ToString();
                        _company.DEFAULTBRANCHCODE    = r["DEFAULTBRANCHCODE"].ToString();
                        _company.DEFAULTDEPTCODE      = r["DEFAULTDEPTCODE"].ToString();
                        _company.PASSWORD             = r["PASSWORD"].ToString();
                        _company.LOCKED               = r["LOCKED"].ToString();
                        _company.DEFAULTAPPROVALLEVEL = r["DEFAULTAPPROVALLEVEL"].ToString();
                        _company.APPROVALSCOPE        = r["APPROVAL SCOPE"].ToString();
                        _company.LANGUAGE             = r["LANGUAGE"].ToString();
                        lstUsers.Add(_company);
                    }
                    oLog.WriteToDebugLogFile("Before Serializing the Company List ", sFuncName);
                    Context.Response.Output.Write(js.Serialize(lstUsers));
                    oLog.WriteToDebugLogFile("After Serializing the Company List , the Serialized data is ' " + js.Serialize(lstUsers) + " '", sFuncName);
                }
                else
                {
                    Context.Response.Output.Write(js.Serialize(lstUsers));
                }

                oLog.WriteToDebugLogFile("Ending Function", sFuncName);
            }
            catch (Exception ex)
            {
                sErrDesc = ex.Message.ToString();
                oLog.WriteToErrorLogFile(sErrDesc, sFuncName);
                oLog.WriteToDebugLogFile("Completed With ERROR  ", sFuncName);
                result objResult = new result();
                objResult.Result         = "Error";
                objResult.DisplayMessage = sErrDesc;
                lstResult.Add(objResult);
                Context.Response.Output.Write(js.Serialize(lstResult));
            }
        }
Beispiel #14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="from"></param>
        /// <param name="to"></param>
        /// <param name="subject"></param>
        /// <param name="body"></param>
        /// <param name="attachments"></param>
        /// <returns></returns>

        public static string SendEmail(string from, string[] tos, string subject, string body, Attachment[] attachments, string embeddedImage)
        {
            string sErrDesc  = string.Empty;
            string sFuncName = string.Empty;

            const Int16 DEBUG_ON     = 1;
            clsLog      oLog         = new clsLog();
            Int16       p_iDebugMode = DEBUG_ON;

            try
            {
                sFuncName = "SendEmail";
                var smtp = new System.Net.Mail.SmtpClient();
                {
                    smtp.Host                  = System.Configuration.ConfigurationManager.AppSettings["SMTPServer"].ToString();
                    smtp.Port                  = int.Parse(System.Configuration.ConfigurationManager.AppSettings["SMTPPort"].ToString());;
                    smtp.EnableSsl             = true;
                    smtp.DeliveryMethod        = System.Net.Mail.SmtpDeliveryMethod.Network;
                    smtp.UseDefaultCredentials = false;
                    smtp.Credentials           = new NetworkCredential(System.Configuration.ConfigurationManager.AppSettings["SMTPUser"].ToString(), System.Configuration.ConfigurationManager.AppSettings["SMTPPassword"].ToString());
                    smtp.Timeout               = 900000;
                }
                MailMessage mail = new MailMessage();

                if (embeddedImage != null)
                {
                    AlternateView  View;
                    LinkedResource resource;

                    View = AlternateView.CreateAlternateViewFromString(body.ToString(), null, "text/html");

                    resource = new LinkedResource(embeddedImage);

                    resource.ContentId = "Logo";

                    View.LinkedResources.Add(resource);

                    mail.AlternateViews.Add(View);
                }

                mail.From = new MailAddress(from);
                foreach (string to in tos)
                {
                    mail.To.Add(to);
                }

                string      ccAddress = System.Configuration.ConfigurationManager.AppSettings["CCEmail"].ToString();
                MailAddress cc        = new MailAddress(ccAddress);
                mail.CC.Add(cc);

                mail.Subject = subject;
                //mail.Body = body;
                if (attachments != null)
                {
                    foreach (Attachment attachment in attachments)
                    {
                        mail.Attachments.Add(attachment);
                    }
                }
                mail.Body       = body;
                mail.IsBodyHtml = true;
                smtp.Send(mail);
                return("Success");
            }
            catch (Exception ex)
            {
                sErrDesc = ex.Message.ToString();
                oLog.WriteToErrorLogFile(sErrDesc, sFuncName);
                if (p_iDebugMode == DEBUG_ON)
                {
                    oLog.WriteToDebugLogFile("Completed With ERROR", sFuncName);
                }
                return(ex.Message);
            }
        }
Beispiel #15
0
        public DataSet SPA_DashboardInfo(string sAppType, string sUserCode)
        {
            DataSet  oDataset  = new DataSet();
            string   sFuncName = string.Empty;
            string   sProcName = string.Empty;
            DataView oDTView   = new DataView();

            try
            {
                sFuncName = "SPA_DashboardInfo()";
                sProcName = "AE_SPA002_Mobile_GetDashboardInfo";

                if (p_iDebugMode == DEBUG_ON)
                {
                    oLog.WriteToDebugLogFile("Starting Function ", sFuncName);
                }

                if (p_iDebugMode == DEBUG_ON)
                {
                    oLog.WriteToDebugLogFile("Calling Run_StoredProcedure() " + sProcName, sFuncName);
                }


                oDataset = SqlHelper.ExecuteDataSet(ConnectionString, CommandType.StoredProcedure, sProcName,
                                                    Data.CreateParameter("@AppType", sAppType), Data.CreateParameter("@UserCode", sUserCode), Data.CreateParameter("@currentDate", DateTime.Now.Date));
                if (p_iDebugMode == DEBUG_ON)
                {
                    oLog.WriteToDebugLogFile("Completed With SUCCESS  ", sFuncName);
                }
                if (oDataset.Tables.Count > 0 && oDataset != null)
                {
                    if (p_iDebugMode == DEBUG_ON)
                    {
                        oLog.WriteToDebugLogFile("There is a set of data from the SP :" + sProcName, sFuncName);
                    }
                    return(oDataset);
                }
                else
                {
                    if (p_iDebugMode == DEBUG_ON)
                    {
                        oLog.WriteToDebugLogFile("There is no data from the SP :" + sProcName, sFuncName);
                    }
                    return(oDataset);
                }
            }
            catch (Exception Ex)
            {
                sErrDesc = Ex.Message.ToString();
                oLog.WriteToErrorLogFile(sErrDesc, sFuncName);
                if (p_iDebugMode == DEBUG_ON)
                {
                    oLog.WriteToDebugLogFile("Completed With ERROR  ", sFuncName);
                }
                throw Ex;
            }
        }
Beispiel #16
0
        public DataSet Get_BitMapPath(DataSet oDTCompanyList, string sCompany)
        {
            DataSet  oDataset  = new DataSet();
            string   sFuncName = string.Empty;
            string   sQuery    = string.Empty;
            DataView oDTView   = new DataView();

            try
            {
                sFuncName = "Get_BitMapPath()";
                sQuery    = "select BitmapPath  from OADP";
                if (p_iDebugMode == DEBUG_ON)
                {
                    oLog.WriteToDebugLogFile("Starting Function ", sFuncName);
                }

                if (p_iDebugMode == DEBUG_ON)
                {
                    oLog.WriteToDebugLogFile("Calling SQLQuery " + sQuery, sFuncName);
                }
                if (oDTCompanyList != null && oDTCompanyList.Tables.Count > 0)
                {
                    oDTView = oDTCompanyList.Tables[0].DefaultView;

                    oDTView.RowFilter = "U_DBName= '" + sCompany + "'";
                    if (oDTView != null && oDTView.Count > 0)
                    {
                        oDataset = SqlHelper.ExecuteDataSet(oDTView[0]["U_ConnString"].ToString(), CommandType.Text, sQuery);

                        if (p_iDebugMode == DEBUG_ON)
                        {
                            oLog.WriteToDebugLogFile("Completed With SUCCESS  ", sFuncName);
                        }
                    }
                    else
                    {
                        if (p_iDebugMode == DEBUG_ON)
                        {
                            oLog.WriteToDebugLogFile("No Data in OUSR table for the selected Company", sFuncName);
                        }
                        return(oDataset);
                    }
                }
                else
                {
                    if (p_iDebugMode == DEBUG_ON)
                    {
                        oLog.WriteToDebugLogFile("There is No Company List in the Holding Company ", sFuncName);
                    }
                    return(oDataset);
                }
                return(oDataset);
            }
            catch (Exception Ex)
            {
                sErrDesc = Ex.Message.ToString();
                oLog.WriteToErrorLogFile(sErrDesc, sFuncName);
                if (p_iDebugMode == DEBUG_ON)
                {
                    oLog.WriteToDebugLogFile("Completed With ERROR  ", sFuncName);
                }
                throw Ex;
            }
        }