Пример #1
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;
            }
        }
Пример #2
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));
            }
        }
Пример #3
0
        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);
        }
Пример #4
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;
            }
        }
Пример #5
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;
            }
        }
Пример #6
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);
            }
        }
Пример #7
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;
            }
        }
Пример #8
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;
            }
        }