コード例 #1
0
        public DataTable GetDataTable(string psSql)
        {
            DataTable dt = new DataTable();

            try {
                using (SCT db = new SCT())
                {
                    string conStr = db.Database.Connection.ConnectionString;

                    using (SqlConnection conn = new SqlConnection(conStr))
                    {
                        SqlCommand cmd = new SqlCommand(psSql, conn);

                        using (SqlDataAdapter ad = new SqlDataAdapter(cmd))

                        {
                            ad.SelectCommand.CommandType = CommandType.Text;
                            ad.Fill(dt);
                        }
                    }
                }
            }
            catch (Exception e) {
                LogError(e.ToString(), "OrderImportClasses.DataHelper.GetDataTable()");
            }

            return(dt);
        }
コード例 #2
0
        public void LogError(string psMessage, string psModule)
        {
            ShippingRequestError E = new ShippingRequestError();// new ShippingRequestError();

            E.DateCreated = System.DateTime.Now;
            E.Module      = psModule;
            E.ErrorDetail = psMessage;
            using (SCT db = new SCT())
            {
                db.ShippingRequestErrors.Add(E);
                db.SaveChanges();
            }
        }
コード例 #3
0
        private string GetConfigProperty(string psProperty)
        {
            string lsResult = "";

            try {
                using (DataModel.SCT db = new DataModel.SCT())
                {
                    SiteConfig sc = db.SiteConfigs.First(s => s.ConfigItem == psProperty);
                    if (sc != null)
                    {
                        lsResult = Util.GetString(sc.ConfigValue);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.LogError(ex.ToString(), "ProcessOrders.GetConfigProperty");
            }

            return(lsResult);
        }