Exemplo n.º 1
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";
			}

		}
		private void BindGroupsList()
		{	
			BPCompanies bpClients = new BPCompanies();
			DSCompanies = bpClients.SelectAllActive();
			ddlGroups.DataBind();

			ddlGroups.Items.Insert(0, new ListItem("", "-99"));
		}
Exemplo n.º 3
0
		private void CheckRentalStatus()
		{
			if (CompanyID > 0)
			{
				BPCompanies bp = new BPCompanies();
				BECompanies DSCompanies = bp.SelectCompaniesByID(CompanyID);
				BECompanies.tbl_CompaniesRow company = DSCompanies.tbl_Companies.FindByCompanyID(CompanyID);

				CanRentOryxInventory = company.CompanyRentalInventory;
			}
			else
			{
				CanRentOryxInventory = false;
			}
		}
Exemplo n.º 4
0
		protected void BindCompanies()
		{
			BPCompanies bp = new BPCompanies();
			DSCompanies = bp.SelectAllActive();
			ddlCompanies.DataBind();

			if (GlobalCompanyID > 0)
			{
				ddlCompanies.Items.FindByValue(GlobalCompanyID.ToString()).Selected = true;
			}
			else
			{
				ddlCompanies.Items.FindByValue(System.Configuration.ConfigurationSettings.AppSettings.Get("OryxCompanyID")).Selected = true;
				GlobalCompanyID = Convert.ToInt32(ddlCompanies.SelectedValue);
			}
		}
Exemplo n.º 5
0
		private void BindDSCompanies()
		{
			BPCompanies BPCompanies = new BPCompanies();
			DSCompanies = BPCompanies.SelectAll();
			DSCompanies.tbl_Companies.DefaultView.Sort = "CompanyName";
			DSCompanies.tbl_Companies.DefaultView.RowFilter = RowFilter("CompanyName", "CompanyActive");

			letters_Bind();
			dgCompanies.DataBind();

			SetPagerButtons();
			if (DSCompanies.tbl_Companies.DefaultView.Count ==  0)
			{
				lblError.Visible = true;
				lblError.Text = "0 Records found.";
			}

			else
			{
				lblError.Visible = false;
				lblError.Text = "";
			}
		}
Exemplo n.º 6
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
			}
		}
Exemplo n.º 7
0
		protected void BindCompanies()
		{
			BPCompanies bp = new BPCompanies();
			ddlCompanies.DataSource = bp.SelectAllActive().tbl_Companies;
			ddlCompanies.DataTextField = "CompanyName";
			ddlCompanies.DataValueField = "CompanyID";
			ddlCompanies.DataBind();
			if (GlobalCompanyID == 0)
			{
				GlobalCompanyID = Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings.Get("OryxCompanyID"));
			}
			if (ddlCompanies.Items.FindByValue(GlobalCompanyID.ToString()) == null)
			{
				GlobalCompanyID = Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings.Get("OryxCompanyID"));
			}
			if (ddlCompanies.Items.FindByValue(GlobalCompanyID.ToString()) != null)
			{
				ddlCompanies.Items.FindByValue(GlobalCompanyID.ToString()).Selected = true;
			}
		}
Exemplo n.º 8
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");
			}
		}
Exemplo n.º 9
0
		private void Page_Load(object sender, EventArgs e)
		{
			this.AuthenticatePage(new string[] {PermissionLevels.EditCompanies, PermissionLevels.AddCompanies, PermissionLevels.ViewCompanies});
			if (CompanyID > 0)
			{
				if (this.OryxUser.RolePermission(PermissionLevels.EditCompanies) != 2)
				{
					btnSubmit.Visible = false;
					btnDelete.Visible = false;
				}
				else
				{
					btnSubmit.Visible = true;
					btnDelete.Visible = true;
				}
			}
			else
			{
				if (this.OryxUser.RolePermission(PermissionLevels.AddCompanies) != 2)
				{
					btnSubmit.Visible = false;
				}
			}

			if (hdnCompanyInformation.Value == "hidden")
			{
				pnlCompanyInformation.CssClass = "panel-closed";
				cntCompanyInformation.Style.Add("display", "none");
				hdnCompanyInformation.Value = "hidden";
			}
			else 
			{
				pnlCompanyInformation.CssClass = "panel-open";
				cntCompanyInformation.Style.Add("display", "");
				hdnCompanyInformation.Value = "visible";
			}

			if (hdnCompanyEmails.Value == "hidden")
			{
				pnlCompanyEmails.CssClass = "panel-closed";
				cntCompanyEmails.Style.Add("display", "none");
				hdnCompanyEmails.Value = "hidden";
			}
			else if (hdnCompanyEmails.Value== "visible")
			{
				pnlCompanyEmails.CssClass = "panel-open";
				cntCompanyEmails.Style.Add("display", "");
				hdnCompanyEmails.Value = "visible";
			}
			else
			{
				pnlCompanyEmails.CssClass = "panel-closed";
				cntCompanyEmails.Style.Add("display", "none");
				hdnCompanyEmails.Value = "hidden";
			}

			if(!IsPostBack)
			{
				ViewCompanyEmails();

				if (CompanyID == 0)
				{
					lblTitle.Text = "Add Company";
					btnDelete.Visible = false;
					btnSubmit.Value = "Next >";
					pnlCompanyEmails.Visible = false;
					pnlColumnAliases.Visible = false;
				}
				else
				{
					BPCompanies bp = new BPCompanies();
					BECompanies ds = bp.SelectCompaniesByID(CompanyID);
					BECompanies.tbl_CompaniesRow Company = ds.tbl_Companies.FindByCompanyID(CompanyID);

					pnlCompanyEmails.Visible = true;
					pnlColumnAliases.Visible = true;
					
					txtCompanyName.Text = Company.CompanyName;
					lblTitle.Text = "Edit Company - " + Company.CompanyName;

					if (! Company.IsCompanyDescriptionNull())
					{
						txtCompanyDescription.Text = Company.CompanyDescription;
					}

					if (Company.IsCompanyImageIDNull() == false)
					{
						ddlCompanyImage.SelectedImage = Company.CompanyImageID;
					}

					txtCompanyAddress1.Text = Company.CompanyAddress1;
					txtCompanyAddress2.Text = Company.CompanyAddress2;
					txtCompanyCity.Text = Company.CompanyCity;
					txtCompanyProvince.Text = Company.CompanyProvince;
					txtCompanyCountry.Text = Company.CompanyCountry;
					txtCompanyPostalCode.Text = Company.CompanyPostalCode;
					txtCompanyPhone.Text = Company.CompanyPhone;
					txtCompanyFax.Text = Company.CompanyFax;
					chkCompanyActive.Checked = Company.CompanyActive;
					chkCompanyRentalInventory.Checked = Company.CompanyRentalInventory;
					
					chkCompanyRentalInventory.Attributes.Add("onclick", "if (document.getElementById(\"chkCompanyRentalInventory\").checked == true) {alert('When the \"Mazz Inventory\" checkbox is checked, column aliases will adpot the configuration of the Mazz column aliases.\\n\\n When you click \"Save\" all of this companies existing column aliases will be overridden.\\n\\n Unchecking this box before clicking \"Save\" will return this companies column aliases to their previous configuration. ');}");
					GetAliasInformation();
				}
			}

			if (CompanyID == Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings.Get("OryxCompanyID")))
			{
				chkCompanyRentalInventory.Enabled = false;
			}

			if (chkCompanyRentalInventory.Checked)
			{
				if (CompanyID != Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings.Get("OryxCompanyID")))
				{
					btnSubmitAliases.Visible = false;
				}

				if (!CheckForOrders())
				{
					chkCompanyRentalInventory.Enabled = true;
				}
				else
				{
					chkCompanyRentalInventory.Enabled = false;
				}
			}
			else
			{
				if (CompanyID > 0)
				{
					if (! CheckForOrders() || this.OryxUser.RolePermission(PermissionLevels.EditCompanyAliases) == 2)
					{
						btnSubmitAliases.Visible = true;
					}
					else
					{
						btnSubmitAliases.Visible = false;
					}
				}
			}
		}
Exemplo n.º 10
0
		private void BindCompanies()
		{
			BPCompanies bp = new BPCompanies();
			ddlCompanyUserCompanyID.DataSource = bp.SelectAll().tbl_Companies;
			ddlCompanyUserCompanyID.DataBind();
			ddlCompanyUserCompanyID.Items.Insert(0, new ListItem("Select a company", "-1"));
		}
Exemplo n.º 11
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);
		}
Exemplo n.º 12
0
		private bool IsCompanyRentalInventory(int CompanyID)
		{
			BPCompanies bp = new BPCompanies();
			BECompanies ds = bp.SelectCompaniesByID(CompanyID);
			if (ds.tbl_Companies.Count > 0)
			{
				return ds.tbl_Companies.FindByCompanyID(CompanyID).CompanyRentalInventory;
			}
			else
			{
				return false;
			}
		}