Thursday, August 27, 2015

FK

USE [TPAManager_be]
GO

/****** Object:  Table [dbo].[States]    Script Date: 08/27/2015 01:55:36 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[States](
[StateNumber] [int] IDENTITY(1,1) NOT NULL,
[State] [nvarchar](50) NULL,
[abrv] [nvarchar](2) NULL,
[ts_upsize] [timestamp] NOT NULL,
 CONSTRAINT [PK_States] PRIMARY KEY CLUSTERED
(
[StateNumber] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 80) ON [PRIMARY]
) ON [PRIMARY]

GO


*******************************
USE [TPAManager_be]
GO

/****** Object:  Table [dbo].[tblCompanyEntityType]    Script Date: 08/27/2015 02:03:50 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[tblCompanyEntityType](
[EntityTypeID] [int] IDENTITY(1,1) NOT NULL,
[EntityTypeName] [nvarchar](100) NULL,
[Status] [nvarchar](20) NULL,
 CONSTRAINT [PK_tblCompanyEntityType] PRIMARY KEY CLUSTERED
(
[EntityTypeID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

****************************************************

USE [TPAManager_be]
GO
/****** Object:  Table [dbo].[States]    Script Date: 08/27/2015 02:02:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[States](
[StateNumber] [int] IDENTITY(1,1) NOT NULL,
[State] [nvarchar](50) NULL,
[abrv] [nvarchar](2) NULL,
[ts_upsize] [timestamp] NOT NULL,
 CONSTRAINT [PK_States] PRIMARY KEY CLUSTERED
(
[StateNumber] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 80) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[States] ON
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (1, N'Alabama', N'AL')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (2, N'Alaska', N'AK')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (3, N'Arkansas', N'AR')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (4, N'Arizona', N'AZ')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (5, N'California', N'CA')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (6, N'Colorado', N'CO')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (7, N'Connecticut', N'CT')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (8, N'Delaware', N'DE')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (9, N'Florida', N'FL')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (10, N'Georgia', N'GA')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (11, N'Hawaii', N'HI')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (12, N'Idaho', N'ID')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (13, N'Indiana', N'IN')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (14, N'Illinois', N'IL')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (15, N'Iowa', N'IA')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (16, N'Kansas', N'KS')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (17, N'Kentucky', N'KY')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (18, N'Louisiana', N'LA')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (19, N'Maine', N'ME')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (20, N'Maryland', N'MD')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (21, N'Massachusetts', N'MA')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (22, N'Michigan', N'MI')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (23, N'Minnesota', N'MN')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (24, N'Mississippi', N'MS')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (25, N'Missouri', N'MO')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (26, N'Montana', N'MT')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (27, N'Nebraska', N'NE')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (28, N'Nevada', N'NV')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (29, N'New Mexico', N'NM')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (30, N'New Hampshire', N'NH')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (31, N'New Jersey', N'NJ')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (32, N'New York', N'NY')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (33, N'North Carolina', N'NC')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (34, N'North Dakota', N'ND')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (35, N'Ohio', N'OH')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (36, N'Oklahoma', N'OK')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (37, N'Oregon', N'OR')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (38, N'Pennsylvania', N'PA')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (39, N'Rhode Island', N'RI')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (40, N'South Carolina', N'SC')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (41, N'South Dakota', N'SD')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (42, N'Tennessee', N'TN')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (43, N'Texas', N'TX')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (44, N'Utah', N'UT')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (45, N'Vermont', N'VT')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (46, N'Virginia', N'VA')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (47, N'Washington', N'WA')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (48, N'D.C.', N'DC')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (49, N'West Virginia', N'WV')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (50, N'Wisconsin', N'WI')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (51, N'Wyoming', N'WY')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (52, N'Guam', N'GU')
INSERT [dbo].[States] ([StateNumber], [State], [abrv]) VALUES (54, N'Virgin Islands', N'VI')
SET IDENTITY_INSERT [dbo].[States] OFF
/****** Object:  Table [dbo].[tblCompanyEntityType]    Script Date: 08/27/2015 02:02:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tblCompanyEntityType](
[EntityTypeID] [int] IDENTITY(1,1) NOT NULL,
[EntityTypeName] [nvarchar](100) NULL,
[Status] [nvarchar](20) NULL,
 CONSTRAINT [PK_tblCompanyEntityType] PRIMARY KEY CLUSTERED
(
[EntityTypeID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[tblCompanyEntityType] ON
INSERT [dbo].[tblCompanyEntityType] ([EntityTypeID], [EntityTypeName], [Status]) VALUES (1, N'C-Corporation', N'Active')
INSERT [dbo].[tblCompanyEntityType] ([EntityTypeID], [EntityTypeName], [Status]) VALUES (2, N'LLC Taxed as Corporation', N'Active')
INSERT [dbo].[tblCompanyEntityType] ([EntityTypeID], [EntityTypeName], [Status]) VALUES (3, N'Limited Liability Partnership', N'Active')
INSERT [dbo].[tblCompanyEntityType] ([EntityTypeID], [EntityTypeName], [Status]) VALUES (4, N'Non Profit Corporation', N'Active')
INSERT [dbo].[tblCompanyEntityType] ([EntityTypeID], [EntityTypeName], [Status]) VALUES (5, N'Partnership', N'Active')
INSERT [dbo].[tblCompanyEntityType] ([EntityTypeID], [EntityTypeName], [Status]) VALUES (6, N'Professional Service Corporation', N'Active')
INSERT [dbo].[tblCompanyEntityType] ([EntityTypeID], [EntityTypeName], [Status]) VALUES (7, N'S-Corporation', N'Active')
INSERT [dbo].[tblCompanyEntityType] ([EntityTypeID], [EntityTypeName], [Status]) VALUES (8, N'Sole Proprietor', N'Active')
INSERT [dbo].[tblCompanyEntityType] ([EntityTypeID], [EntityTypeName], [Status]) VALUES (9, N'Other', N'Active')
INSERT [dbo].[tblCompanyEntityType] ([EntityTypeID], [EntityTypeName], [Status]) VALUES (10, N'LLC Taxed as Partnership', N'Active')
INSERT [dbo].[tblCompanyEntityType] ([EntityTypeID], [EntityTypeName], [Status]) VALUES (11, N'Government', N'Active')
INSERT [dbo].[tblCompanyEntityType] ([EntityTypeID], [EntityTypeName], [Status]) VALUES (12, N'LLC Taxed as Sole Proprietorship', N'Active')
INSERT [dbo].[tblCompanyEntityType] ([EntityTypeID], [EntityTypeName], [Status]) VALUES (13, N'Sole Proprietorhip', N'Inactive')
INSERT [dbo].[tblCompanyEntityType] ([EntityTypeID], [EntityTypeName], [Status]) VALUES (14, N'LLC', N'Inactive')
INSERT [dbo].[tblCompanyEntityType] ([EntityTypeID], [EntityTypeName], [Status]) VALUES (15, N'PLLC', N'Inactive')
INSERT [dbo].[tblCompanyEntityType] ([EntityTypeID], [EntityTypeName], [Status]) VALUES (16, N'LLC Taxed as S- Corporation', N'Active')
SET IDENTITY_INSERT [dbo].[tblCompanyEntityType] OFF

Monday, February 9, 2015

SendEmail

 public void SendEmail(string email, string body, string subject, string sender)
    {
        if (email.Trim() != "" && email.Trim() != " ")
        {
            if (isEmail(email))
            {
                try
                {
                    System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
                    if (sender != "")
                    {
                        message.From = new MailAddress(sender);
                    }
                    else
                    {
                        message.From = new MailAddress("serviceteam@julyservices.com");
                    }

                    var emails = email.Split(new Char[] { ',', ';' });
                    foreach (var to in emails)
                    {
                        if (!String.IsNullOrEmpty(to))
                            message.To.Add(new MailAddress(to));
                    }

                    message.To.Add(new MailAddress(email));
                    message.Subject = subject;
                    message.Body = body;
                    message.Priority = System.Net.Mail.MailPriority.High;
                    message.IsBodyHtml = true;

                    //SmtpClient smtpClient = new SmtpClient("mail.texaspension.com");
                    //smtpClient.UseDefaultCredentials = true;

                    System.Net.Mail.SmtpClient smtpClient = new SmtpClient();
                    smtpClient.Host = "mail.julyservices.com";
                    System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential("dp_smtp", "Dp$123456", "julyservices");
                    smtpClient.Credentials = SMTPUserInfo;
                    smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;

                    smtpClient.Send(message);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
    }

Upload a file in ASP.NET

http://www.codeproject.com/Articles/1757/File-Upload-with-ASP-NET

public string UploadPersonalFile(HttpPostedFile myFile, string ContactID)
        {
          
            proposalcenterfunctions proposalfunctions = new proposalcenterfunctions();
this.strRootFilePath = @"" + ConfigurationManager.AppSettings["CensusDataFilesParentDirectory"];

            ProjectPath = "Contacts\\" + ContactID;
            PhysicalDirPath = strRootFilePath + ProjectPath;
            DirectoryInfo clientDir = new DirectoryInfo(PhysicalDirPath);
            if (clientDir.Exists == false)
            {
                clientDir.Create();
            }
            // Get size of uploaded file
            int nFileLen = myFile.ContentLength;
            try
            {
                // make sure the size of the file is > 0
                if (nFileLen > 0)
                {
                    // Allocate a buffer for reading of the file
                    byte[] myData = new byte[nFileLen];
                    // Read uploaded file from the Stream
                    myFile.InputStream.Read(myData, 0, nFileLen);
                    // Create a name for the file to store
                    string strFilename = Path.GetFileName(myFile.FileName);
                    string Extension = strFilename.Remove(0, strFilename.LastIndexOf('.'));
                    string fileName = strFilename.Substring(0, strFilename.Length - Extension.Length);
                    var dateTime = DateTime.Now.ToString("MMddyy_hh-mm-ss");
                    strFilename = fileName + "_" + dateTime + Extension;
                    strFullFilePath = PhysicalDirPath + "\\" + strFilename;
                    proposalfunctions.WriteToFile(strFullFilePath, ref myData);
                }
                else
                {
                    strFullFilePath = "";
                }
            }
            catch (Exception ex)
            {
                ExceptionLogger.WriteLog(ex, "UploadFile");
            }

            return strFullFilePath;
        }



 public void WriteToFile(string strPath, ref byte[] Buffer)
        {
            FileStream stream = new FileStream(strPath, FileMode.Create);
            stream.Write(Buffer, 0, Buffer.Length);
            stream.Close();
        }