Example #1
0
		private void GetCompanyColumns()
		{
			BPCompanyAliases bp = new BPCompanyAliases();
			BECompanies ds = bp.SelectCompanyColumnsByCompanyID(CompanyID);
			if (ds.tbl_CompanyAliases.Count > 0)
			{
				BECompanies.tbl_CompanyAliasesRow Columns = ds.tbl_CompanyAliases[0];

				ddlColumns.Items.Clear();
				ddlColumns.Items.Insert(0, new ListItem(Columns.Description, Columns.Table.Columns["Description"].ColumnName));
				dgInventory.Levels[0].Columns[3].HeadingText = Columns.Description;
				dgEquipmentOrdered.Levels[0].Columns[3].HeadingText = Columns.Description;
				ddlColumns.Items.Insert(1, new ListItem(Columns.Box, Columns.Table.Columns["Box"].ColumnName));
				dgInventory.Levels[0].Columns[4].HeadingText = Columns.Box;
				dgEquipmentOrdered.Levels[0].Columns[4].HeadingText = Columns.Box;
				ddlColumns.Items.Insert(2, new ListItem(Columns.Pin, Columns.Table.Columns["Pin"].ColumnName));
				dgInventory.Levels[0].Columns[5].HeadingText = Columns.Pin;
				dgEquipmentOrdered.Levels[0].Columns[5].HeadingText = Columns.Pin;
				ddlColumns.Items.Insert(3, new ListItem(Columns.ItemNumber, Columns.Table.Columns["ItemNumber"].ColumnName));
				dgInventory.Levels[0].Columns[2].HeadingText = Columns.ItemNumber;
				dgEquipmentOrdered.Levels[0].Columns[2].HeadingText = Columns.ItemNumber;
				ddlColumns.Items.Insert(4, new ListItem(Columns.Box2, Columns.Table.Columns["Box2"].ColumnName));
				dgInventory.Levels[0].Columns[6].HeadingText = Columns.Box2;
				dgEquipmentOrdered.Levels[0].Columns[6].HeadingText = Columns.Box2;
				ddlColumns.Items.Insert(5, new ListItem(Columns.MajorOD, Columns.Table.Columns["MajorOD"].ColumnName));
				dgInventory.Levels[0].Columns[7].HeadingText = Columns.MajorOD;
				dgEquipmentOrdered.Levels[0].Columns[7].HeadingText = Columns.MajorOD;
				ddlColumns.Items.Insert(6, new ListItem(Columns.MinorOD, Columns.Table.Columns["MinorOD"].ColumnName));
				dgInventory.Levels[0].Columns[8].HeadingText = Columns.MinorOD;
				dgEquipmentOrdered.Levels[0].Columns[8].HeadingText = Columns.MinorOD;
				ddlColumns.Items.Insert(7, new ListItem(Columns.InsideDiameter, Columns.Table.Columns["InsideDiameter"].ColumnName));
				dgInventory.Levels[0].Columns[9].HeadingText = Columns.InsideDiameter;
				dgEquipmentOrdered.Levels[0].Columns[9].HeadingText = Columns.InsideDiameter;
				ddlColumns.Items.Insert(8, new ListItem(Columns.SealtoSealLength, Columns.Table.Columns["SealtoSealLength"].ColumnName));
				dgInventory.Levels[0].Columns[10].HeadingText = Columns.SealtoSealLength;
				dgEquipmentOrdered.Levels[0].Columns[10].HeadingText = Columns.SealtoSealLength;
				ddlColumns.Items.Insert(9, new ListItem(Columns.FloatBore, Columns.Table.Columns["FloatBore"].ColumnName));
				dgInventory.Levels[0].Columns[11].HeadingText = Columns.FloatBore;
				dgEquipmentOrdered.Levels[0].Columns[11].HeadingText = Columns.FloatBore;
			}
			else
			{
				ddlColumns.Items.Clear();
				ddlColumns.Items.Insert(0, new ListItem("Description", "Description"));
				dgInventory.Levels[0].Columns[3].HeadingText = "Description";
				dgEquipmentOrdered.Levels[0].Columns[3].HeadingText = "Description";
				ddlColumns.Items.Insert(1, new ListItem("Box", "Box"));
				dgInventory.Levels[0].Columns[4].HeadingText = "Box";
				dgEquipmentOrdered.Levels[0].Columns[4].HeadingText = "Box";
				ddlColumns.Items.Insert(2, new ListItem("Pin", "Pin"));
				dgInventory.Levels[0].Columns[5].HeadingText = "Pin";
				dgEquipmentOrdered.Levels[0].Columns[5].HeadingText = "Pin";
				ddlColumns.Items.Insert(3, new ListItem("ItemNumber", "ItemNumber"));
				dgInventory.Levels[0].Columns[2].HeadingText = "ItemNumber";
				dgEquipmentOrdered.Levels[0].Columns[2].HeadingText = "ItemNumber";
				ddlColumns.Items.Insert(4, new ListItem("Box2", "Box2"));
				dgInventory.Levels[0].Columns[6].HeadingText = "Box2";
				dgEquipmentOrdered.Levels[0].Columns[6].HeadingText = "Box2";
				ddlColumns.Items.Insert(5, new ListItem("MajorOD", "MajorOD"));
				dgInventory.Levels[0].Columns[7].HeadingText = "MajorOD";
				dgEquipmentOrdered.Levels[0].Columns[7].HeadingText = "MajorOD";
				ddlColumns.Items.Insert(6, new ListItem("MinorOD", "MinorOD"));
				dgInventory.Levels[0].Columns[8].HeadingText = "MinorOD";
				dgEquipmentOrdered.Levels[0].Columns[8].HeadingText = "MinorOD";
				ddlColumns.Items.Insert(7, new ListItem("InsideDiameter", "InsideDiameter"));
				dgInventory.Levels[0].Columns[9].HeadingText = "InsideDiameter";
				dgEquipmentOrdered.Levels[0].Columns[9].HeadingText = "InsideDiameter";
				ddlColumns.Items.Insert(8, new ListItem("SealtoSealLength", "SealtoSealLength"));
				dgInventory.Levels[0].Columns[10].HeadingText = "SealtoSealLength";
				dgEquipmentOrdered.Levels[0].Columns[10].HeadingText = "SealtoSealLength";
				ddlColumns.Items.Insert(9, new ListItem("FloatBore", "FloatBore"));
				dgInventory.Levels[0].Columns[11].HeadingText = "FloatBore";
				dgEquipmentOrdered.Levels[0].Columns[11].HeadingText = "FloatBore";
			}
			ddlColumns.Items.Insert(0, new ListItem("(all columns)","-1"));
		}
Example #2
0
		public void CreateAndSendEmails(int orderID, string pdfFilePath)
		{
			BPOrders bpOrder = new BPOrders();
			BPOrderDetails bpDetails = new BPOrderDetails();
			BEOrders dsOrder = bpOrder.SelectOrdersByID(orderID);
			dsOrder.Merge(bpDetails.SelectOrderDetailsWithInventoryByOrderID(orderID));
			BEOrders.tbl_OrdersRow order = (BEOrders.tbl_OrdersRow) dsOrder.tbl_Orders.Rows[0];

			BPCompanyEmails bp = new BPCompanyEmails();
			BPCompanies bpCompany = new BPCompanies();
			BPCompanyAliases bpAliases = new BPCompanyAliases();

			BECompanies ds = bp.SelectActiveCompanyEmailsByCompanyID(order.CompanyID);
			ds.Merge(bpCompany.SelectCompaniesByID(order.CompanyID));
			ds.Merge(bpAliases.SelectCompanyColumnsByCompanyID(order.CompanyID));

			BECompanies.tbl_CompanyAliasesRow aliases = (BECompanies.tbl_CompanyAliasesRow) ds.tbl_CompanyAliases.Rows[0];
			BECompanies.tbl_CompaniesRow company;
			bool hasHuntingInventoryAccess = false;
			string CompanyImage = "";

			if(ds.tbl_Companies.Count > 0)
			{
				company = (BECompanies.tbl_CompaniesRow) ds.tbl_Companies.Rows[0];

				if (!company.IsCompanyImageIDNull())
				{
					BPImages bpImages = new BPImages();
					BEImages DSImages = bpImages.SelectByID(company.CompanyImageID);
					string imageName = DSImages.tbl_Images.FindByImageID(company.CompanyImageID).ImageName;
					CompanyImage = "<img src='" + companyLogoPath + "l_" + imageName + "' />";
				}

				hasHuntingInventoryAccess = company.CompanyRentalInventory;
			}

			MailMessage mm = new MailMessage();
			mm.Subject = "Confirmation of " + _EmailType.ToUpper() + " ID:" + orderID;
			foreach (BECompanies.tbl_CompanyEmailsRow row in ds.tbl_CompanyEmails.Rows)
			{
				mm.To += row.CompanyEmail + ";";
			}

			mm.From = ConfigurationSettings.AppSettings.Get("AdministratorEmailFrom");
			
			mm.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserverport"] = Convert.ToInt32(ConfigurationSettings.AppSettings["SmtpServerPort"]);
			SmtpMail.SmtpServer = ConfigurationSettings.AppSettings.Get("SmtpServer");

			string createOrder = "";
			createOrder += "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>";
			createOrder += "<Html><head><LINK href='" + cssLinkPath + "screen.css' type='text/css' rel='stylesheet'></head><body class='alignleft'><div class='top'></div><div class='wrap'>";

			createOrder += "<table border='0' cellspacing='0' cellpadding='0' style='margin-bottom:10px;' class='tablewidth'><tr>";
			createOrder += "<td><img src='" + huntingLogoPath + "' /></td>";
			createOrder += "<td style='text-align:right;'>" + CompanyImage + "</td>";
			createOrder += "</tr></table>";
			
			//new order details table
			createOrder += "<table class='orderdetails tablewidth'>";
			createOrder += "<tr><th colspan='4' class='heading'>Confirmation of " + _EmailType.ToUpper() + " ID: " + order.OrderID + "</th></tr><tr>";

			createOrder += "<th width='20%'>Date</th>";
			createOrder += "<td width='30%'>" + order.OrderDate.ToString("MMM d, yyyy h:mm tt") + "</td>";
			createOrder += "<th width='20%'>&nbsp;</th>";
			createOrder += "<td width='30%'>&nbsp;</td>";
			createOrder += "</tr>";

			createOrder += "<tr>";
			if (_EmailType == "Order")
			{
				createOrder += "<th>Ordered By </th>";
			}
			else
			{
				createOrder += "<th>Received By </th>";
			}

			createOrder += "<td>" + order.OrderRequestedBy + "</td>";
			createOrder += "<th width='16%'>Rig </th>";
			createOrder += "<td width='34%'>" + order.OrderRigNumber + "</td>";
			createOrder += "</tr>";

			createOrder += "<tr>";
			createOrder += "<th>Ship To </th>";
			createOrder += "<td>" + order.OrderShipTo + "</td>";
			createOrder += "<th>Job # </th>";
			createOrder += "<td>" + order.OrderJobNumber + "</td>";
			createOrder += "</tr>";

			createOrder += "<tr>";
			createOrder += "<th>Via </th>";
			createOrder += "<td>" + order.OrderShipVIA + "</td>";
			createOrder += "<th>Lease </th>";
			createOrder += "<td>" + order.OrderLeaseNumber + "</td>";
			createOrder += "</tr>";

			createOrder += "<tr>";
			if (_EmailType == "Order")
			{
				createOrder += "<th>Date Required </th>";
			}
			else
			{
				createOrder += "<th>Date Received </th>";
			}
			
			createOrder += "<td>" + order.OrderDateRequired.ToString("MMM d, yyyy") + "</td>";
			if (_EmailType == "Order")
			{
				createOrder += "<th>Time Required</th>";
			}
			else
			{
				createOrder += "<th>Time Received</th>";
			}
			
			createOrder += "<td>" + order.OrderTimeRequired + "</td>";
			createOrder += "</tr>";

			createOrder += "<tr>";
			createOrder += "<th>Comments</th>";
			createOrder += "<td colspan='3'>" + order.OrderComments + "</td>";
			createOrder += "</tr></table><div style='page-break-after:avoid'>&nbsp;</div>";

			ArrayList columns = new ArrayList();
			createOrder += "<table class='emailitemdetails'><tr>";
			
			if(hasHuntingInventoryAccess)
			{
				createOrder += "<th width='40px'>B/R</th>";
				columns.Add("BuyRentStatus");
			}

			createOrder += "<th>" + aliases.ItemNumber + "</th>";
			columns.Add("ItemNumber");
			createOrder += "<th>" + aliases.Description +  "</th>";
			columns.Add("Description");
			createOrder += "<th>" + aliases.Box +  "</th>";
			columns.Add("Box");
			createOrder += "<th>" + aliases.Pin + "</th>";
			columns.Add("Pin");
			createOrder += "<th>" + aliases.MajorOD + "</th>";
			columns.Add("MajorOD");
			createOrder += "<th>" + aliases.MinorOD + "</th>";
			columns.Add("MinorOD");
			createOrder += "<th>" + aliases.InsideDiameter + "</th>";
			columns.Add("InsideDiameter");
			createOrder += "<th>" + aliases.SealtoSealLength + "</th>";
			columns.Add("SealtoSealLength");
			createOrder += "<th>" + aliases.FloatBore + "</th>";
			columns.Add("FloatBore");
			createOrder += "<th>" + aliases.Box2 + "</th>";
			columns.Add("Box2");
			createOrder += "<th>" + aliases.GeneralComments + "</th>";
			columns.Add("GeneralComments");

			if (!aliases.IsExtraColumn1Null())
			{
				createOrder += "<th>" + aliases.ExtraColumn1 + "</th>";
				columns.Add("ExtraColumn1");
			}
			if (!aliases.IsExtraColumn2Null())
			{
				createOrder += "<th>" + aliases.ExtraColumn2 + "</th>";
				columns.Add("ExtraColumn2");
			}
			if (!aliases.IsExtraColumn3Null())
			{
				createOrder += "<th>" + aliases.ExtraColumn3 + "</th>";
				columns.Add("ExtraColumn3");
			}
			if (!aliases.IsExtraColumn4Null())
			{
				createOrder += "<th>" + aliases.ExtraColumn4 + "</th>";
				columns.Add("ExtraColumn4");
			}
			if (!aliases.IsExtraColumn5Null())
			{
				createOrder += "<th>" + aliases.ExtraColumn5 + "</th>";
				columns.Add("ExtraColumn5");
			}
			if (!aliases.IsExtraColumn6Null())
			{
				createOrder += "<th>" + aliases.ExtraColumn6 + "</th>";
				columns.Add("ExtraColumn6");
			}
			if (!aliases.IsExtraColumn7Null())
			{
				createOrder += "<th>" + aliases.ExtraColumn7 + "</th>";
				columns.Add("ExtraColumn7");
			}
			if (!aliases.IsExtraColumn8Null())
			{
				createOrder += "<th>" + aliases.ExtraColumn8 + "</th>";
				columns.Add("ExtraColumn8");
			}
			if (!aliases.IsExtraColumn9Null())
			{
				createOrder += "<th>" + aliases.ExtraColumn9 + "</th>";
				columns.Add("ExtraColumn9");
			}
			if (!aliases.IsExtraColumn10Null())
			{
				createOrder += "<th>" + aliases.ExtraColumn10 + "</th>";
				columns.Add("ExtraColumn10");
			}
			createOrder += "<td class='lastcell'>&nbsp;&nbsp;</td></tr>";

			int rowCount = 0;
			string strColor2 = "";

			foreach (BEOrders.tbl_OrderDetailsRow item in dsOrder.tbl_OrderDetails.Rows)
			{
				rowCount += 1;	
				if (rowCount % 2 == 0)
				{
					strColor2 = "#efefef";
				}
				else
				{
					strColor2 = "#ffffff";
				}
				createOrder += "<tr style='page-break-inside:avoid'>";
				foreach (string col in columns)
				{
					if (item[col] != null && item[col].ToString() != "")
					{
						if(col == "BuyRentStatus")
							createOrder += "<td nowrap bgColor='" + strColor2 + "'>" + item[col].ToString() + "</td>";
						else
							createOrder += "<td bgColor='" + strColor2 + "'>" + item[col].ToString() + "</td>";
					}
					else
					{
						createOrder += "<td bgColor='" + strColor2 + "'>&nbsp;</td>";
					}
				}
				createOrder += "<td class='lastcell'>&nbsp;&nbsp;</td></tr>";
			}	
			createOrder += "</table>";

			createOrder += "<br><div style='page-break-inside:avoid;'><hr><table cellpadding='0' cellspacing='0' border='0' align='center'>";
			createOrder += "<tr><td align='center'>";
			createOrder += "If you require further clarification please call Mazz Oilfield Services. Customer Service at (403) 720-6299.";

			createOrder += "<br/>";
			createOrder += " Thank you for using Mazz Oilfield Services Online!";
			createOrder += "</td></tr></table><hr></div>";
			
			createOrder += "<br><table class='shippingdept' style='width: 550px !important;' align='center'>";
			createOrder += "<tr><th colspan='2' class='heading'>ORDER ID: " + order.OrderID + " - Shipping Verification</th></tr>";
			createOrder += "<tr><th>Information Check List</th><th width='50%'>Shipper's Initial</td></th>";
			createOrder += "<tr bgColor='#efefef'><td><img src='" + activeIconPath + "'>  Check Box Connections</td><td>&nbsp;</td></tr>";
			createOrder += "<tr><td><img src='" + activeIconPath + "'>  Check Pin Connections</td><td>&nbsp;</td></tr>";
			createOrder += "<tr bgColor='#efefef'><td><img src='" + activeIconPath + "'>  Check Serial Numbers</td><td>&nbsp;</td></tr>";
			createOrder += "<tr><td><img src='" + activeIconPath + "'>  Gauge Float Bore</td><td>&nbsp;</td></tr>";
			createOrder += "<tr bgColor='#efefef'><td><img src='" + activeIconPath + "'>  Gauge UBHO Bore</td><td>&nbsp;</td></tr>";
			createOrder += "<tr><td><img src='" + activeIconPath + "'>  Check Protectors</td><td>&nbsp;</td></tr>";
			createOrder += "</table><br>";



			createOrder += "<br><table class='receiver' align='center'>";
			createOrder += "<tr><td align='left'>All Items Verified and Thread Protectors Installed:</td><td align='center'>____________________________________</td></tr>";
			createOrder += "<tr><td>&nbsp;</td><td align='center'>RECEIVER</td></tr>";
			createOrder += "</table></br>";


			createOrder += "</div><div class='bottom'></div>";
			createOrder += "</body></html>";

			string pdfFileName = "ConfirmOrderID_" + orderID + ".pdf";
			string fullPDFFilePath = pdfFilePath + pdfFileName;

			ConvertHTMLToPDF(createOrder, fullPDFFilePath);

			try
			{
				mm.Body = "Please review the attached PDF file for Order Confirmation";
			
				MailAttachment pdfAttachment = new MailAttachment(fullPDFFilePath);
				mm.Attachments.Add(pdfAttachment);

				mm.BodyFormat = MailFormat.Html;
			
				SmtpMail.Send(mm);

				if (File.Exists(fullPDFFilePath))
					File.Delete(fullPDFFilePath);
			}
			catch (Exception ex)
			{
				ex.ToString();
				//				Response.Redirect (strMWRequestBad);
				//response.write "There was a problem sending the email";
			}

		}
		protected void FillAvailableTokens()
		{
			ddlAvailableTokens.Items.Clear();
			if (ddlTokenCategories.SelectedValue != "0")
			{
				BPTokens bpTokens = new BPTokens();
				BEQuickReports dsTokens = new BEQuickReports();
				BPCompanyAliases bpAliases = new BPCompanyAliases();
				Hashtable aliases = bpAliases.SelectColumnMappings(CompanyID);

				dsTokens = bpTokens.SelectByTokenCategoryID(Convert.ToInt32(ddlTokenCategories.SelectedValue));

				ListItem item;
				foreach (BEQuickReports.tbl_TokensRow row in dsTokens.tbl_Tokens)
				{
					item = new ListItem();
					item.Value = row.TokenID.ToString();
					if (!row.LookupAlias)
					{
						item.Text = row.TokenAlias.Replace('_',' ');
						ddlAvailableTokens.Items.Add(item);
					}
					else
					{
						string columnName = row.TokenColumns.Replace("|","");
						if (aliases.Count > 0 && aliases.ContainsKey(columnName) && aliases[columnName].ToString()!="")
						{
							item.Text = aliases[columnName].ToString();	
							ddlAvailableTokens.Items.Add(item);
						}
						else if (! columnName.StartsWith("ExtraColumn"))
						{
							item.Text = row.TokenAlias.Replace('_',' ');
							ddlAvailableTokens.Items.Add(item);
						}
					}
				}
			}
		}
		protected void FillSelectedTokens()
		{
			if (GeneratedReportID > 0)
			{
				ddlSelectedTokens.Items.Clear();
				BPTokens bpTokens = new BPTokens();
				BEQuickReports dsTokens = new BEQuickReports();
				BPCompanyAliases bpAliases = new BPCompanyAliases();
				Hashtable aliases = bpAliases.SelectColumnMappings(CompanyID);

				dsTokens = bpTokens.SelectByGeneratedReportID(GeneratedReportID);

				ListItem item;
				foreach (BEQuickReports.tbl_TokensRow row in dsTokens.tbl_Tokens)
				{
					item = new ListItem();
					item.Value = row.TokenID.ToString().Replace('_',' ');
					if (!row.LookupAlias)
					{
						item.Text = row.TokenAlias.Replace('_',' '); //.Replace added, part of bug fix 20090603 - hs
					}
					else
					{
						string columnName = row.TokenColumns.Replace("|","");
						if (aliases.Count > 0 && aliases.ContainsKey(columnName) && aliases[columnName].ToString()!="")
						{
							item.Text = aliases[columnName].ToString();	
						}
						else
						{
							item.Text = row.TokenAlias.Replace('_',' ');
						}
					}
					ddlSelectedTokens.Items.Add(item);
					SelectedTokens.Value += item.Value + ",";
				}
			}
		}
		private void FillTextBoxes()
		{
			if (GeneratedReportID != 0)
			{
				BPCompanyAliases bpAliases = new BPCompanyAliases();
				Hashtable aliases = bpAliases.SelectColumnMappings(CompanyID);

				BPGeneratedReports bp = new BPGeneratedReports();
				BPGeneratedReportTokens bpGRT = new BPGeneratedReportTokens();
				BEQuickReports ds = new BEQuickReports();
				ds = bp.SelectByID(GeneratedReportID);
				ds.Merge(bpGRT.SelectByGeneratedReportID(GeneratedReportID));
				BEQuickReports.tbl_GeneratedReportsRow report = ds.tbl_GeneratedReports.FindByGeneratedReportID(GeneratedReportID);
				txtReportAlias.Text = report.GeneratedReportName;
				if (ddlVisibility.Items.FindByValue(Convert.ToInt32(report.GeneralReport).ToString()) != null)
				{
					ddlVisibility.SelectedValue = Convert.ToInt32(report.GeneralReport).ToString();
				}
				QuickReportID = report.QuickReportID;
				GeneratedReportType = (QuickReport.GeneratedReportTypes) report.GeneratedReportType;
				gridDataSource.Fill(ds.tbl_GeneratedReportTokens, aliases);
			}
		}
		private void UpdateDataSource()
		{
			string CompanyColumnAlias = "";
			BPCompanyAliases bpAliases = new BPCompanyAliases();
			Hashtable aliases = bpAliases.SelectColumnMappings(CompanyID);

			BPTokens bp = new BPTokens();
			BEQuickReports ds = bp.SelectByQuickReportID(QuickReportID);
			foreach (BEQuickReports.tbl_TokensRow row in ds.tbl_Tokens.Rows)
			{
				if (row.LookupAlias)
				{
					string columnName = row.TokenColumns.Replace("|","");
					if (aliases.Count > 0 && aliases.ContainsKey(columnName) && aliases[columnName].ToString()!="")
					{
						CompanyColumnAlias = aliases[columnName].ToString();	
					}
					else if (! columnName.StartsWith("ExtraColumn"))
					{
						CompanyColumnAlias = row.TokenAlias.Replace('_',' ');
					}
				}
				else
					CompanyColumnAlias = ""; //bug fix 20090603 - hs

//				else
//				{
//					CompanyColumnAlias = row.TokenAlias.Replace('_', ' ');
//				}

				if (gridDataSource.GetTokenByTokenID(row.TokenID) == null)
				{
					if (SelectedTokensList.Contains(row.TokenID))
					{
						gridDataSource.Add(row, CompanyColumnAlias);
					}
				}
				else if (! SelectedTokensList.Contains(row.TokenID))
				{
					gridDataSource.Remove(row);
				}
			}
		}
Example #7
0
		private void btnSubmitAliases_ServerClick(object sender, System.EventArgs e)
		{
			BECompanies.tbl_CompanyAliasesRow alias;
			BPCompanyAliases bp = new BPCompanyAliases();
			BECompanies DSCompanyAliases = bp.SelectCompanyAliasesByCompanyID(CompanyID);

			if (CompanyHasAliases == false)
			{
				alias = DSCompanyAliases.tbl_CompanyAliases.Newtbl_CompanyAliasesRow();
			}
			else
			{
				if (DSCompanyAliases.tbl_CompanyAliases.Count > 0)
				{
					CompanyHasAliases = true;
					alias = DSCompanyAliases.tbl_CompanyAliases[0];
				}
				else
				{
					CompanyHasAliases = false;
					alias = DSCompanyAliases.tbl_CompanyAliases.Newtbl_CompanyAliasesRow();
				}
			}
			alias.CompanyID = CompanyID;
			if (txtDescription.Text.Trim().Length > 0)
			{
				alias.Description = txtDescription.Text.Trim();
			}
			else
			{
				alias.SetDescriptionNull();
			}

			if (txtBox.Text.Trim().Length > 0)
			{
				alias.Box = txtBox.Text.Trim();
			}
			else
			{
				alias.SetDescriptionNull();
			}

			if (txtPin.Text.Trim().Length > 0)
			{
				alias.Pin = txtPin.Text.Trim();
			}
			else
			{
				alias.SetPinNull();
			}

			if (txtItemNumber.Text.Trim().Length > 0)
			{
				alias.ItemNumber = txtItemNumber.Text.Trim();
			}
			else
			{
				alias.SetItemNumberNull();
			}

			if (txtBox2.Text.Trim().Length > 0)
			{
				alias.Box2 = txtBox2.Text.Trim();
			}
			else
			{
				alias.SetBox2Null();
			}

//			if (txtPin2.Text.Trim().Length > 0)
//			{
//				alias.Pin2 = txtPin2.Text;
//			}
//			else
//			{
//				alias.SetPin2Null();
//			}

			if (txtMajorOD.Text.Trim().Length > 0)
			{
				alias.MajorOD = txtMajorOD.Text.Trim();
			}
			else
			{
				alias.SetMajorODNull();
			}

			if (txtMinorOD.Text.Trim().Length > 0)
			{
				alias.MinorOD = txtMinorOD.Text.Trim();
			}
			else
			{
				alias.SetMinorODNull();
			}

			if (txtInsideDiameter.Text.Trim().Length > 0)
			{
				alias.InsideDiameter = txtInsideDiameter.Text.Trim();
			}
			else
			{
				alias.SetInsideDiameterNull();
			}

			if (txtSealtoSeal.Text.Trim().Length > 0)
			{
				alias.SealtoSealLength = txtSealtoSeal.Text.Trim();
			}
			else
			{
				alias.SetSealtoSealLengthNull();
			}

			if (txtFloatBore.Text.Trim().Length > 0)
			{
				alias.FloatBore = txtFloatBore.Text.Trim();
			}
			else
			{
				alias.SetFloatBoreNull();
			}

//			if (txtQuantity.Text.Trim().Length > 0)
//			{
//				alias.Quantity = txtQuantity.Text;
//			}
//			else
//			{
//				alias.SetQuantityNull();
//			}

			if(txtComments.Text.Trim().Length > 0)
			{
				alias.GeneralComments = txtComments.Text.Trim();
			}


			if (txtExtraColumn1.Text.Trim().Length > 0)
			{
				alias.ExtraColumn1 = txtExtraColumn1.Text.Trim();
			}
			else
			{
				alias.SetExtraColumn1Null();
			}

			if (txtExtraColumn2.Text.Trim().Length > 0)
			{
				alias.ExtraColumn2 = txtExtraColumn2.Text.Trim();
			}
			else
			{
				alias.SetExtraColumn2Null();
			}

			if (txtExtraColumn3.Text.Trim().Length > 0)
			{
				alias.ExtraColumn3 = txtExtraColumn3.Text.Trim();
			}
			else
			{
				alias.SetExtraColumn3Null();
			}

			if (txtExtraColumn4.Text.Trim().Length > 0)
			{
				alias.ExtraColumn4 = txtExtraColumn4.Text.Trim();
			}
			else
			{
				alias.SetExtraColumn4Null();
			}

			if (txtExtraColumn5.Text.Trim().Length > 0)
			{
				alias.ExtraColumn5 = txtExtraColumn5.Text.Trim();
			}
			else
			{
				alias.SetExtraColumn5Null();
			}

			if (txtExtraColumn6.Text.Trim().Length > 0)
			{
				alias.ExtraColumn6 = txtExtraColumn6.Text.Trim();
			}
			else
			{
				alias.SetExtraColumn6Null();
			}

			if (txtExtraColumn7.Text.Trim().Length > 0)
			{
				alias.ExtraColumn7 = txtExtraColumn7.Text.Trim();
			}
			else
			{
				alias.SetExtraColumn7Null();
			}

			if (txtExtraColumn8.Text.Trim().Length > 0)
			{
				alias.ExtraColumn8 = txtExtraColumn8.Text.Trim();
			}
			else
			{
				alias.SetExtraColumn8Null();
			}

			if (txtExtraColumn9.Text.Trim().Length > 0)
			{
				alias.ExtraColumn9 = txtExtraColumn9.Text.Trim();
			}
			else
			{
				alias.SetExtraColumn9Null();
			}

			if (txtExtraColumn10.Text.Trim().Length > 0)
			{
				alias.ExtraColumn10 = txtExtraColumn10.Text.Trim();
			}
			else
			{
				alias.SetExtraColumn10Null();
			}

			if (CompanyHasAliases == false)
			{
				DSCompanyAliases.tbl_CompanyAliases.Rows.Add(alias);
			}
			bp.Update(DSCompanyAliases); 
            
			//potential bug fix - not sure if it's what they really want yet. 20090209 - hs
			//if(CompanyID == Convert.ToInt32(ConfigurationSettings.AppSettings["OryxCompanyID"]))
				//bp.SyncExtraColumnAliases(CompanyID);            
		}
Example #8
0
		private void ChangeColumnNames()
		{
			BPCompanyAliases bp = new BPCompanyAliases();
			Hashtable ht = bp.SelectColumnMappings(GlobalCompanyID);
			if (ht.Count > 0)
			{
				foreach (GridColumn column in dgOrders.Levels[1].Columns)
				{
					if (ht.ContainsKey(column.DataField) && ht[column.DataField] != null && ht[column.DataField].ToString() != "")
					{
						column.HeadingText = ht[column.DataField].ToString();
					}
				}
			}
		}
Example #9
0
		private void GetAliasInformation()
		{
			BPCompanyAliases bp = new BPCompanyAliases();
			BECompanies DSCompanyAliases = bp.SelectCompanyAliasesByCompanyID(CompanyID);
			if (DSCompanyAliases.tbl_CompanyAliases.Count > 0)
			{
				CompanyHasAliases = true;

				BECompanies.tbl_CompanyAliasesRow alias = DSCompanyAliases.tbl_CompanyAliases[0];

				if (!alias.IsDescriptionNull())
				{
					txtDescription.Text = alias.Description;
				}
				if (!alias.IsBoxNull())
				{
					txtBox.Text = alias.Box;
				}
				if (!alias.IsPinNull())
				{
					txtPin.Text = alias.Pin;
				}
				if (!alias.IsItemNumberNull())
				{
					txtItemNumber.Text = alias.ItemNumber;
				}
				if (!alias.IsBox2Null())
				{
					txtBox2.Text = alias.Box2;
				}
//				if (!alias.IsPin2Null())
//				{
//					txtPin2.Text = alias.Pin2;
//				}
				if (!alias.IsMajorODNull())
				{
					txtMajorOD.Text = alias.MajorOD;
				}
				if (!alias.IsMinorODNull())
				{
					txtMinorOD.Text = alias.MinorOD;
				}
				if (!alias.IsInsideDiameterNull())
				{
					txtInsideDiameter.Text = alias.InsideDiameter;
				}
				if (!alias.IsSealtoSealLengthNull())
				{
					txtSealtoSeal.Text = alias.SealtoSealLength;
				}
				if (!alias.IsFloatBoreNull())
				{
					txtFloatBore.Text = alias.FloatBore;
				}
//				if (!alias.IsQuantityNull())
//				{
//				txtQuantity.Text = alias.Quantity;
//				}
				if(!alias.IsGeneralCommentsNull())
				{
					txtComments.Text = alias.GeneralComments;
				}

				//extra columns
				if (!alias.IsExtraColumn1Null())
				{
					txtExtraColumn1.Text = alias.ExtraColumn1;
				}
				if (!alias.IsExtraColumn2Null())
				{
					txtExtraColumn2.Text = alias.ExtraColumn2;
				}
				if (!alias.IsExtraColumn3Null())
				{
					txtExtraColumn3.Text = alias.ExtraColumn3;
				}
				if (!alias.IsExtraColumn4Null())
				{
					txtExtraColumn4.Text = alias.ExtraColumn4;
				}
				if (!alias.IsExtraColumn5Null())
				{
					txtExtraColumn5.Text = alias.ExtraColumn5;
				}
				if (!alias.IsExtraColumn6Null())
				{
					txtExtraColumn6.Text = alias.ExtraColumn6;
				}
				if (!alias.IsExtraColumn7Null())
				{
					txtExtraColumn7.Text = alias.ExtraColumn7;
				}
				if (!alias.IsExtraColumn8Null())
				{
					txtExtraColumn8.Text = alias.ExtraColumn8;
				}
				if (!alias.IsExtraColumn9Null())
				{
					txtExtraColumn9.Text = alias.ExtraColumn9;
				}
				if (!alias.IsExtraColumn10Null())
				{
					txtExtraColumn10.Text = alias.ExtraColumn10;
				}
			}
			else
			{
				CompanyHasAliases = false;
			}
		}
Example #10
0
		private void btnDelete_Click(object sender, EventArgs e)
		{
			if (CompanyID != Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings.Get("OryxCompanyID")))
			{
				//Delete Company
				BPCompanies bp = new BPCompanies();
				BECompanies.tbl_CompaniesRow Company;
				DSCompanies = bp.SelectCompaniesByID(CompanyID);
				Company = DSCompanies.tbl_Companies.FindByCompanyID(CompanyID);
				Company.Delete();
				bp.Update(DSCompanies);

				//Delete Company Aliases
				BPCompanyAliases bpAliases = new BPCompanyAliases();
				DSCompanies = bpAliases.SelectCompanyAliasesByCompanyID(CompanyID);
				foreach (BECompanies.tbl_CompanyAliasesRow row in DSCompanies.tbl_CompanyAliases.Rows)
				{
					row.Delete();
				}
				bpAliases.Update(DSCompanies);

				//Delete Company Emails
				BPCompanyEmails bpEmails = new BPCompanyEmails();
				DSCompanies = bpEmails.SelectCompanyEmailsByCompanyID(CompanyID);
				foreach (BECompanies.tbl_CompanyEmailsRow row in DSCompanies.tbl_CompanyEmails.Rows)
				{
					row.Delete();
				}
				bpEmails.Update(DSCompanies);

				Response.Redirect("BrowseCompanies.aspx");
			}
			else
			{
				//TODO: Insert Message here stating that Oryx company Cannot be deleted, please see your web master
			}
		}
Example #11
0
		private void btnSubmit_ServerClick(object sender, EventArgs e)
		{
			if (chkCompanyRentalInventory.Checked)
			{
				pnlColumnAliases.Visible = false;
			}

			BPCompanies bp = new BPCompanies();
			BECompanies.tbl_CompaniesRow Company;
			DSCompanies = new BECompanies();
			if (CompanyID == 0)
			{
				// Add new Company
				Company = DSCompanies.tbl_Companies.Newtbl_CompaniesRow();
			}
			else
			{
				// Edit a Company
				DSCompanies = bp.SelectCompaniesByID(CompanyID);
				Company = DSCompanies.tbl_Companies.FindByCompanyID(CompanyID);				
			}
			//all content to be updated/inserted between here
			Company.CompanyName = txtCompanyName.Text;

			ImageWizard ddlCompanyImage = Page.FindControl("ddlCompanyImage") as ImageWizard;
			if (ddlCompanyImage.SelectedImage > 0)
			{
				Company.CompanyImageID = Convert.ToInt32(ddlCompanyImage.SelectedImage);
			}
			else
			{
				Company.SetCompanyImageIDNull();
			}

			Company.CompanyDescription = txtCompanyDescription.Text + " ";
			Company.CompanyAddress1 = txtCompanyAddress1.Text;
			Company.CompanyAddress2 = txtCompanyAddress2.Text;
			Company.CompanyCity = txtCompanyCity.Text;
			Company.CompanyProvince = txtCompanyProvince.Text;
			Company.CompanyCountry = txtCompanyCountry.Text;
			Company.CompanyPostalCode = txtCompanyPostalCode.Text;
			Company.CompanyPhone = txtCompanyPhone.Text;
			Company.CompanyFax = txtCompanyFax.Text;
			Company.CompanyActive = chkCompanyActive.Checked;
			if (CompanyID != Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings.Get("OryxCompanyID")))
			{
				Company.CompanyRentalInventory = chkCompanyRentalInventory.Checked;
			}
			else
			{
				Company.CompanyRentalInventory = true;
			}
			
			Company.DateModified = DateTime.Now;
			Company.ModifiedByAdminID = Convert.ToInt32(OryxUser.OryxIdentity.MemberID);
			//all content to be updated/inserted between here			
			if (CompanyID == 0)
			{
				//Add new Application Category
				Company.DateCreated = DateTime.Now;
				DSCompanies.tbl_Companies.Addtbl_CompaniesRow(Company);
			}
			bp.Update(DSCompanies);

			//CreateResizedImage(BEImages DSImages, int ImageID, string prefix, int width, int height, Page page)
			if (!Company.IsCompanyImageIDNull())
			{
				MWUtility.CreateResizedImage(Company.CompanyImageID, "l", "", imageSize, 0, this);
			}

			if (chkCompanyRentalInventory.Checked && CompanyID != Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["OryxCompanyID"]))
			{
				BPCompanyAliases bpAliases = new BPCompanyAliases();

				//delete all of the company Aliases incase they have more aliases than Oryx, otherwise those extra columns would not get over-ridden.
				DSNewCompanyAliases = bpAliases.SelectCompanyAliasesByCompanyID(CompanyID);
				if (DSNewCompanyAliases.tbl_CompanyAliases.Count > 0)
				{
					BECompanies.tbl_CompanyAliasesRow deletealias = DSNewCompanyAliases.tbl_CompanyAliases[0];
					deletealias.Delete();
					bpAliases.Update(DSNewCompanyAliases);
				}

				//Get Oryx's Aliases first
				DSCompanyAliases = bpAliases.SelectCompanyAliasesByCompanyID(Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings.Get("OryxCompanyID")));
				if (DSCompanyAliases.tbl_CompanyAliases.Count > 0)
				{
					BECompanies.tbl_CompanyAliasesRow alias = DSCompanyAliases.tbl_CompanyAliases[0];

					//replace the company Aliases with Oryx's aliases
					BECompanies.tbl_CompanyAliasesRow newalias;
					DSNewCompanyAliases = bpAliases.SelectCompanyAliasesByCompanyID(Company.CompanyID);
					if (DSNewCompanyAliases.tbl_CompanyAliases.Count > 0)
					{
						CompanyHasAliases = true;
						newalias = DSNewCompanyAliases.tbl_CompanyAliases[0];
					}
					else
					{
						CompanyHasAliases = false;
						newalias = DSNewCompanyAliases.tbl_CompanyAliases.Newtbl_CompanyAliasesRow();
					}
					newalias.CompanyID = Company.CompanyID;

					if (! alias.IsDescriptionNull()) newalias.Description = alias.Description;
					if (! alias.IsBoxNull()) newalias.Box = alias.Box;
					if (! alias.IsPinNull()) newalias.Pin = alias.Pin;
					if (! alias.IsItemNumberNull()) newalias.ItemNumber = alias.ItemNumber;
					if (! alias.IsBox2Null()) newalias.Box2 = alias.Box2;
					if (! alias.IsMajorODNull()) newalias.MajorOD = alias.MajorOD;
					if (! alias.IsMinorODNull()) newalias.MinorOD = alias.MinorOD;
					if (! alias.IsInsideDiameterNull()) newalias.InsideDiameter = alias.InsideDiameter;
					if (! alias.IsSealtoSealLengthNull()) newalias.SealtoSealLength = alias.SealtoSealLength;
					if (! alias.IsFloatBoreNull()) newalias.FloatBore = alias.FloatBore;
					if (! alias.IsGeneralCommentsNull()) newalias.GeneralComments = alias.GeneralComments;

					if (! alias.IsExtraColumn1Null()) newalias.ExtraColumn1 = alias.ExtraColumn1;
					if (! alias.IsExtraColumn2Null()) newalias.ExtraColumn2 = alias.ExtraColumn2;
					if (! alias.IsExtraColumn3Null()) newalias.ExtraColumn3 = alias.ExtraColumn3;
					if (! alias.IsExtraColumn4Null()) newalias.ExtraColumn4 = alias.ExtraColumn4;
					if (! alias.IsExtraColumn5Null()) newalias.ExtraColumn5 = alias.ExtraColumn5;
					if (! alias.IsExtraColumn6Null()) newalias.ExtraColumn6 = alias.ExtraColumn6;
					if (! alias.IsExtraColumn7Null()) newalias.ExtraColumn7 = alias.ExtraColumn7;
					if (! alias.IsExtraColumn8Null()) newalias.ExtraColumn8 = alias.ExtraColumn8;
					if (! alias.IsExtraColumn9Null()) newalias.ExtraColumn9 = alias.ExtraColumn9;
					if (! alias.IsExtraColumn10Null()) newalias.ExtraColumn10 = alias.ExtraColumn10;

					if (CompanyHasAliases == false)
					{
						DSNewCompanyAliases.tbl_CompanyAliases.Rows.Add(newalias);
					}
					bpAliases.Update(DSNewCompanyAliases);
				}     
			}

			if (CompanyID == 0)
			{
				Response.Redirect("EditCompanies.aspx?CompanyID=" + Company.CompanyID);
			}
			else
			{
				Response.Redirect("BrowseCompanies.aspx");
			}
		}
Example #12
0
		private void RenameLabels()
		{
			ClearLabels();
			if (CompanyID > 0)
			{
				BPCompanyAliases bp = new BPCompanyAliases();
				BECompanies ds = bp.SelectCompanyColumnsByCompanyID(CompanyID);
				if (ds.tbl_CompanyAliases.Rows.Count > 0)
				{
					BECompanies.tbl_CompanyAliasesRow aliases = ((BECompanies.tbl_CompanyAliasesRow) ds.tbl_CompanyAliases.Rows[0]);
					lblItemNumber.Text = aliases.ItemNumber;
					lblDescription.Text = aliases.Description;
					lblBox.Text = aliases.Box;
					lblPin.Text = aliases.Pin;
					lblBox2.Text = aliases.Box2;
					lblMajorOD.Text = aliases.MajorOD;
					lblMinorOD.Text = aliases.MinorOD;
					lblInsideDiameter.Text = aliases.InsideDiameter;
					lblSealToSeal.Text = aliases.SealtoSealLength;
					lblFloatBore.Text = aliases.FloatBore;
					lblComments.Text = aliases.GeneralComments;
					if (!aliases.IsExtraColumn1Null()) {lblExtraColumn1.Text = aliases.ExtraColumn1;}
					if (!aliases.IsExtraColumn2Null()) {lblExtraColumn2.Text = aliases.ExtraColumn2;}
					if (!aliases.IsExtraColumn3Null()) {lblExtraColumn3.Text = aliases.ExtraColumn3;}
					if (!aliases.IsExtraColumn4Null()) {lblExtraColumn4.Text = aliases.ExtraColumn4;}
					if (!aliases.IsExtraColumn5Null()) {lblExtraColumn5.Text = aliases.ExtraColumn5;}
					if (!aliases.IsExtraColumn6Null()) {lblExtraColumn6.Text = aliases.ExtraColumn6;}
					if (!aliases.IsExtraColumn7Null()) {lblExtraColumn7.Text = aliases.ExtraColumn7;}
					if (!aliases.IsExtraColumn8Null()) {lblExtraColumn8.Text = aliases.ExtraColumn8;}
					if (!aliases.IsExtraColumn9Null()) {lblExtraColumn9.Text = aliases.ExtraColumn9;}
					if (!aliases.IsExtraColumn10Null()) {lblExtraColumn10.Text = aliases.ExtraColumn10;}
				}
			}
			if (lblItemNumber.Text == "")
				lblItemNumber.Text = "Unit # ";
			if (lblDescription.Text == "")
				lblDescription.Text = "Description ";
			if (lblBox.Text == "")
				lblBox.Text = "Connection #1 ";
			if (lblPin.Text == "")
				lblPin.Text = "Connection #2 ";
			if (lblMajorOD.Text == "")
				lblMajorOD.Text = "Major OD ";
			if (lblMinorOD.Text == "")
				lblMinorOD.Text = "Minor OD ";
			if (lblInsideDiameter.Text == "")
				lblInsideDiameter.Text = "Inside Diameter ";
			if (lblSealToSeal.Text == "")
				lblSealToSeal.Text = "Seal To Seal ";
			if (lblFloatBore.Text == "")
				lblFloatBore.Text = "Float Bore ";
			if (lblBox2.Text == "")
				lblBox2.Text = "Serial # ";
			if (lblComments.Text == "")
				lblComments.Text = "Comments";

			for (int i=1; i<=10; i++)
			{
				if (((Label) this.FindControl("lblExtraColumn" + i)).Text == "")
				{
					this.FindControl("lblExtraColumn" + i).Visible = false;
					this.FindControl("txtExtraColumn" + i).Visible = false;
				}
				else
				{
					this.FindControl("lblExtraColumn" + i).Visible = true;
					this.FindControl("txtExtraColumn" + i).Visible = true;
				}
			}
		}
Example #13
0
		public void CreateAndSendEmails(int orderID)
		{
			BPOrders bpOrder = new BPOrders();
			BPOrderDetails bpDetails = new BPOrderDetails();
			BEOrders dsOrder = bpOrder.SelectOrdersByID(orderID);
			dsOrder.Merge(bpDetails.SelectOrderDetailsWithInventoryByOrderID(orderID));
			BEOrders.tbl_OrdersRow order = (BEOrders.tbl_OrdersRow) dsOrder.tbl_Orders.Rows[0];

			BPCompanyEmails bp = new BPCompanyEmails();
			BPCompanies bpCompany = new BPCompanies();
			BPCompanyAliases bpAliases = new BPCompanyAliases();

			BECompanies ds = bp.SelectActiveCompanyEmailsByCompanyID(order.CompanyID);
			ds.Merge(bpCompany.SelectCompaniesByID(order.CompanyID));
			ds.Merge(bpAliases.SelectCompanyColumnsByCompanyID(order.CompanyID));

			BECompanies.tbl_CompanyAliasesRow aliases = (BECompanies.tbl_CompanyAliasesRow) ds.tbl_CompanyAliases.Rows[0];
			BECompanies.tbl_CompaniesRow company;
			bool hasHuntingInventoryAccess = false;
			string CompanyImage = "";

			if(ds.tbl_Companies.Count > 0)
			{
				company = (BECompanies.tbl_CompaniesRow) ds.tbl_Companies.Rows[0];

				if (!company.IsCompanyImageIDNull())
				{
					BPImages bpImages = new BPImages();
					BEImages DSImages = bpImages.SelectByID(company.CompanyImageID);
					string imageName = DSImages.tbl_Images.FindByImageID(company.CompanyImageID).ImageName;
					CompanyImage = "<img src='" + companyLogoPath + "l_" + imageName + "' />";
				}

				hasHuntingInventoryAccess = company.CompanyRentalInventory;
			}

			string createOrder = "";

			createOrder += "<table border='0' cellspacing='0' cellpadding='0'><tr>";
			createOrder += "<td><img src='" + huntingLogoPath + "' /></td>";
			createOrder += "<td style='text-align:right;'>" + CompanyImage + "</td>";
			createOrder += "</tr></table>";
			createOrder += "<br>";
			
			createOrder += "<table class='orderdetails'>";
			createOrder += "<tr><th colspan='4' class='heading'>Confirmation of " + _EmailType.ToUpper() + " ID: " + order.OrderID + "</th></tr><tr>";

			createOrder += "<th width='20%'>Date</th>";
			createOrder += "<td width='30%'>" + order.OrderDate.ToString("MMM d, yyyy h:mm tt") + "</td>";
			createOrder += "<th width='20%'>&nbsp;</th>";
			createOrder += "<td width='30%'>&nbsp;</td>";
			createOrder += "</tr>";

			createOrder += "<tr>";
			if (_EmailType == "Order")
			{
				createOrder += "<th>Ordered By </th>";
			}
			else
			{
				createOrder += "<th>Transferred By </th>";
			}
			createOrder += "<td>" + order.OrderRequestedBy + "</td>";
			createOrder += "<th width='16%'>Rig </th>";
			createOrder += "<td width='34%'>" + order.OrderRigNumber + "</td>";
			createOrder += "</tr>";

			createOrder += "<tr>";
			createOrder += "<th>Ship To </th>";
			createOrder += "<td>" + order.OrderShipTo + "</td>";
			createOrder += "<th>Job # </th>";
			createOrder += "<td>" + order.OrderJobNumber + "</td>";
			createOrder += "</tr>";

			createOrder += "<tr>";
			createOrder += "<th>Via </th>";
			createOrder += "<td>" + order.OrderShipVIA + "</td>";
			createOrder += "<th>Lease </th>";
			createOrder += "<td>" + order.OrderLeaseNumber + "</td>";
			createOrder += "</tr>";

			createOrder += "<tr>";
			createOrder += "<th>Date Required </th>";
			createOrder += "<td>" + order.OrderDateRequired.ToString("MMM d, yyyy") + "</td>";
			createOrder += "<th>Time Required</th>";
			createOrder += "<td>" + order.OrderTimeRequired + "</td>";
			createOrder += "</tr>";

			createOrder += "<tr>";
			createOrder += "<th>Comments</th>";
			createOrder += "<td colspan='3'>" + order.OrderComments + "</td>";
			createOrder += "</tr></table>";

			ArrayList columns = new ArrayList();
			createOrder += "<br><table class='itemdetails'><tr>";

			if(hasHuntingInventoryAccess)
			{
				createOrder += "<th width='40px' nowrap='true'>B/R</th>";
				columns.Add("BuyRentStatus");
			}

			createOrder += "<th>" + aliases.ItemNumber + "</th>";
			columns.Add("ItemNumber");
			createOrder += "<th>" + aliases.Description +  "</th>";
			columns.Add("Description");
			createOrder += "<th>" + aliases.Box +  "</th>";
			columns.Add("Box");
			createOrder += "<th>" + aliases.Pin + "</th>";
			columns.Add("Pin");
			createOrder += "<th>" + aliases.MajorOD + "</th>";
			columns.Add("MajorOD");
			createOrder += "<th>" + aliases.MinorOD + "</th>";
			columns.Add("MinorOD");
			createOrder += "<th>" + aliases.InsideDiameter + "</th>";
			columns.Add("InsideDiameter");
			createOrder += "<th>" + aliases.SealtoSealLength + "</th>";
			columns.Add("SealtoSealLength");
			createOrder += "<th>" + aliases.FloatBore + "</th>";
			columns.Add("FloatBore");
			createOrder += "<th>" + aliases.Box2 + "</th>";
			columns.Add("Box2");
			createOrder += "<th>" + aliases.GeneralComments + "</th>";
			columns.Add("GeneralComments");

			if (!aliases.IsExtraColumn1Null())
			{
				createOrder += "<th>" + aliases.ExtraColumn1 + "</th>";
				columns.Add("ExtraColumn1");
			}
			if (!aliases.IsExtraColumn2Null())
			{
				createOrder += "<th>" + aliases.ExtraColumn2 + "</th>";
				columns.Add("ExtraColumn2");
			}
			if (!aliases.IsExtraColumn3Null())
			{
				createOrder += "<th>" + aliases.ExtraColumn3 + "</th>";
				columns.Add("ExtraColumn3");
			}
			if (!aliases.IsExtraColumn4Null())
			{
				createOrder += "<th>" + aliases.ExtraColumn4 + "</th>";
				columns.Add("ExtraColumn4");
			}
			if (!aliases.IsExtraColumn5Null())
			{
				createOrder += "<th>" + aliases.ExtraColumn5 + "</th>";
				columns.Add("ExtraColumn5");
			}
			if (!aliases.IsExtraColumn6Null())
			{
				createOrder += "<th>" + aliases.ExtraColumn6 + "</th>";
				columns.Add("ExtraColumn6");
			}
			if (!aliases.IsExtraColumn7Null())
			{
				createOrder += "<th>" + aliases.ExtraColumn7 + "</th>";
				columns.Add("ExtraColumn7");
			}
			if (!aliases.IsExtraColumn8Null())
			{
				createOrder += "<th>" + aliases.ExtraColumn8 + "</th>";
				columns.Add("ExtraColumn8");
			}
			if (!aliases.IsExtraColumn9Null())
			{
				createOrder += "<th>" + aliases.ExtraColumn9 + "</th>";
				columns.Add("ExtraColumn9");
			}
			if (!aliases.IsExtraColumn10Null())
			{
				createOrder += "<th>" + aliases.ExtraColumn10 + "</th>";
				columns.Add("ExtraColumn10");
			}
			createOrder += "</tr>";
			int rowCount = 0;
			string strColor2 = "";
			foreach (BEOrders.tbl_OrderDetailsRow item in dsOrder.tbl_OrderDetails.Rows)
			{
				rowCount += 1;	
				if (rowCount % 2 == 0)
				{
					strColor2 = "#efefef";
				}
				else
				{
					strColor2 = "#ffffff";
				}
				createOrder += "<tr class='tablerows' bgColor='" + strColor2 + "'>";
				foreach (string col in columns)
				{
					if (item[col] != null && item[col].ToString() != "")
					{
						createOrder += "<td>" + item[col].ToString() + "</td>";
					}
					else
					{
						createOrder += "<td>&nbsp;</td>";
					}
				}
				createOrder += "</tr>";
			}	
			createOrder += "</table>";


			createOrder += "<table cellpadding='0' cellspacing='0' border='0' align='center'>";
			createOrder += "<tr><td align='center'>_________________________________________________</td></tr>";
			createOrder += "<tr><td align='center'>";
			createOrder += "If you require further clarification please call <br/>";
			createOrder += "Mazz Oilfield Services. Customer Service at:<br>";
			createOrder += "(403) 720-6299";
			createOrder += "<br/><br/>";
			createOrder += " Thank you for using Mazz Oilfield Services Online.";
			createOrder += "</td></tr></table>";

			createOrder += "</div><div class='bottom'></div>";

			Response.Write(createOrder);
		}