public string GetMyAddress() { var address = Value.ADDR_1; if (MyConvert.ConvertToString(Value.ADDR_2).Length > 2) { address += " " + Value.ADDR_2; } if (MyConvert.ConvertToString(Value.CITY).Length > 1) { address += " " + Value.CITY; } if (MyConvert.ConvertToString(Value.STATE).Length > 1) { address += ", " + Value.STATE; } if (MyConvert.ConvertToString(Value.ZIPCODE).Length > 4) { address += ", " + Value.ZIPCODE; } return(address); }
public override string IsValidated() { var b = true; string validationResult = ""; //Installation Address var msc = new MySalesJobMasterListCustomer(BaseValue.JobID); msc.SetInstallTo(); if (msc.CustomerID == 0) { validationResult += "No Installation Company Selected " + System.Environment.NewLine; b = false; } else { var mc = new MyCustomer(msc.CustomerID); if (MyConvert.ConvertToString(mc.Value.ADDR_1).Length < 5) { validationResult += "No Installation Address " + System.Environment.NewLine; b = false; } } //Document Attached var requiredDocuemntTypes = new int[] { 200 }; for (int i = 0; i < requiredDocuemntTypes.Length; i++) { var docTypeID = requiredDocuemntTypes[i]; var docAttached = _db.PermitDocuments.Where(x => x.BaseAppID == BaseValue.BaseAppID & x.DocType == docTypeID).ToList(); if (!docAttached.Any()) { var docType = _db.PermitDocumentTypes.Find(docTypeID); validationResult += "Document Required: " + docType.TypeName + System.Environment.NewLine; b = false; } } //Leadtime if (BaseValue.Deadline <= DateTime.Today) { validationResult += "Lead time is 5 business days " + System.Environment.NewLine; b = false; } else { var endDate = Convert.ToDateTime(BaseValue.Deadline); if (MyDateTime.GetDiffHoursOfWeekday(DateTime.Today, endDate) < 24 * NLeadTime) { validationResult += "Lead time is 5 business days " + System.Environment.NewLine; b = false; } } return(b ? "ok" : validationResult); }
public void InsertServices() { var sd = new ServiceDefinition(ServiceGroup, 0); DataTable t1 = sd.Tbl; if (t1 == null) { return; } int printOrder = GetQsMaxPrintOrder() + 1; try { foreach (DataRow row in t1.Rows) { InsertRecord(Convert.ToInt32(row["PC_ID"]), MyConvert.ConvertToString(row["Charge"]), 1, MyConvert.ConvertToString(row["CONTENTS"]), MyConvert.ConvertToString(row["PS_NAME"]), MyConvert.ConvertToString(row["Charge"]), printOrder ); } t1.Clear(); } catch (SqlException ex) { string errorLog = ex.Message; } finally { } }
public string GetDescriptionWithHtmlBreak() { var s = MyConvert.ConvertToString(Value.Description); if (Value.IsTemplateApplicable) { return(s); } if (!SpecialFields.Any()) { return(s); } s += Environment.NewLine; var i = 1; foreach (var field in SpecialFields) { if (!MyConvert.IsNullString(field.Contents)) { s += Convert.ToString(i) + ") " + field.Title + ": " + field.Contents + "<br />"; i++; } } return(s); }
private void InitializeProperties(DataRow row) { bAll = Convert.ToBoolean(row["B00"]); b01 = Convert.ToBoolean(row["B01"]); b02 = Convert.ToBoolean(row["B02"]); b03 = Convert.ToBoolean(row["B03"]); b04 = Convert.ToBoolean(row["B04"]); b05 = Convert.ToBoolean(row["B05"]); b06 = Convert.ToBoolean(row["B06"]); b07 = Convert.ToBoolean(row["B07"]); b08 = Convert.ToBoolean(row["B08"]); b09 = Convert.ToBoolean(row["B09"]); b10 = Convert.ToBoolean(row["B10"]); b11 = Convert.ToBoolean(row["B11"]); b12 = Convert.ToBoolean(row["B12"]); _d1 = Convert.ToInt32(row["BeginDate"]); _d2 = Convert.ToInt32(row["EndDate"]); bDate = DateTime.Today.AddDays(_d1); eDate = DateTime.Today.AddDays(_d2); int1 = Convert.ToInt32(row["Int1"]); int2 = Convert.ToInt32(row["Int2"]); int3 = Convert.ToInt32(row["Int3"]); int4 = Convert.ToInt32(row["Int4"]); int5 = Convert.ToInt32(row["Int5"]); CustomString1 = MyConvert.ConvertToString(row["CustomString1"]); CustomString2 = MyConvert.ConvertToString(row["CustomString2"]); EmployeeName = MyConvert.ConvertToString(row["EmployeeName"]); }
public virtual void CopyItems(int myParentID, DataSet ds1, DataTable tblItems) { foreach (DataRow row in tblItems.Rows) { if (Convert.ToBoolean(row["isFinal"])) { DataRow rowNew = ds1.Tables["t1"].NewRow(); rowNew["woID"] = _myParentID; rowNew["estItemID"] = MyConvert.ConvertToInteger(row["estItemID"]); rowNew["estItemNameText"] = MyConvert.ConvertToString(row["estItemNameText"]); string copyDetails = SalesCenterConfiguration.CopyDetailsToWorkorder; if (copyDetails.Trim().ToLower() == "yes") { rowNew["woDescription"] = MyConvert.ConvertToString(row["Description"]); } else { rowNew["woDescription"] = DBNull.Value; } rowNew["woPrintOrder"] = MyConvert.ConvertToInteger(row["PrintOrder"]); rowNew["qty"] = MyConvert.ConvertToInteger(row["qty"]); rowNew["qtyPC"] = MyConvert.ConvertToInteger(row["qtyPC"]); rowNew["heightFromGround"] = MyConvert.ConvertToString(row["heightFromGround"]); int requirement = MyConvert.ConvertToInteger(row["Requirement"]); if (requirement < 10) { requirement = 10; } rowNew["Requirement"] = requirement; rowNew["Position"] = "Outdoor"; if (!Convert.IsDBNull(row["Position"])) { rowNew["Position"] = row["Position"]; } rowNew["fromWhere"] = NGenerateTitleFrom.Estimation; rowNew["scHydroInspectionRequired"] = false; rowNew["scPurpose"] = 0; rowNew["scPurpose1"] = false; rowNew["scPurpose2"] = false; rowNew["scPurpose3"] = false; rowNew["scPurpose4"] = false; //Item ID rowNew["nameDetailsID"] = row["nameDetailsID"]; rowNew["qiAmount"] = MyConvert.ConvertToDouble(row["estimatorPrice"]); string s = "E" + string.Format("{0:D2}", row["SerialID"]); rowNew["SerialID"] = s; rowNew["BySubcontractor"] = row["BySubcontractor"]; ds1.Tables["t1"].Rows.Add(rowNew); } } }
public override string GetQiTitle(string requirement, DataRow row) { //Level 1: Title (PrintOrder +Title --WithFormat + rquirement); Amout //Level 2: Description string newTitle = MyConvert.ConvertToString(row["qiItemTitle"]); return(newTitle); }
public QuoteItemReportAdd_Service(DataTable tbl, int quoteRevID) { try { DataTable tbl2 = GetItemsList(quoteRevID); DataTable tbl3 = GetItemsGroupByPrintOrder(quoteRevID); if (tbl2 != null & tbl3 != null) { //row Data foreach (DataRow row in tbl2.Rows) { int printOrder = Convert.ToInt32(row["qiPrintOrder"]); int optionCount = GetOptionCount(printOrder, tbl3); DataRow rowNew = tbl.NewRow(); //row New rowNew["PrintOrder"] = AddPrintOrderBaseNumber(printOrder); row["qiAmountText"] = ConvertToF2Format(row["qiAmountText"]); QuoteItemPrintFormat qiTO = GetQuoteItemPrintFormat(row, optionCount); rowNew["Title"] = qiTO.qiTitle; rowNew["QuoteOption"] = qiTO.qiOption; rowNew["HtmlAmount"] = qiTO.HtmlTitleAmount; rowNew["HtmlAmountOption"] = qiTO.HtmlOptionAmount; rowNew["Description"] = qiTO.Description; if (!MyConvert.IsNullString(row["qiAmount"])) { string sq1 = MyConvert.ConvertToString(row["qiAmount"]); if (MyConvert.IsAccountingFormatNumberic(sq1)) { rowNew["Amount"] = MyConvert.ConvertAccountingFormatStringToDouble(sq1); } } tbl.Rows.Add(rowNew); } } } catch (SqlException ex) { string errorLog = ex.Message; } finally { } _tbl = tbl; }
private void InitializationProperties(DataRow row) { if (row == null) { return; } JobId = MyConvert.ConvertToInteger(row["jobID"]); WorkedHour = MyConvert.ConvertToDouble(row["workedHour"]); FinishedDate = MyConvert.ConvertToDate(row["FinishedDate"]); NumberOfDrawing = MyConvert.ConvertToInteger(row["NumberOfDrawing"]); Note = MyConvert.ConvertToString(row["Note"]); }
public void ImportAddressFromCustomer() { //Subcontract-->Project-->IsInstallTo->Contact and Customer var subcontract = new MySubContract(Value.SubContractID); var msc = new MySalesJobMasterListCustomer(subcontract.Value.JobID); msc.SetInstallTo(); if (msc.CustomerID < 1000) { Result = "Request Failed, No Install to Customer Selected."; } else { var myCustomer = new MyCustomer(msc.CustomerID); var myContact = new MyCustomerContact(msc.ContactID); string addr = myCustomer.Value.ADDR_1; if (!Convert.IsDBNull(myCustomer.Value.ADDR_2)) { addr = addr + " " + myCustomer.Value.ADDR_2; } Value.Address = addr; Value.City = myCustomer.Value.CITY; Value.Postcode = myCustomer.Value.ZIPCODE; Value.Province = myCustomer.Value.STATE; Value.ShipToName = myCustomer.Value.NAME; string attenName = MyConvert.ConvertToString(myContact.Value.CONTACT_HONORIFIC) + " "; attenName += MyConvert.ConvertToString(myContact.Value.CONTACT_FIRST_NAME) + " "; attenName += MyConvert.ConvertToString(myContact.Value.CONTACT_LAST_NAME); Value.AttnName = attenName.Trim(); Value.AttnPhone = MyConvert.ConvertToString(myContact.Value.CONTACT_PHONE); _db.Entry(Value).State = EntityState.Modified; _db.SaveChanges(); Result = "ok"; } }
public string GetDescription() { var s = MyConvert.ConvertToString(Value.Description); if (Value.IsTemplateApplicable) { return(s); } if (!SpecialFields.Any()) { return(s); } s += Environment.NewLine; foreach (var field in SpecialFields) { s += Convert.ToString(field.OrderNumber) + ") " + field.Title + ": " + field.Contents + Environment.NewLine; } return(s); }
//13227 /// <summary> /// Collumn : Name /// Collumn 0: Rate /// Collumn 1: SupplyOnly /// Collumn 2: Installation /// </summary> public void Refresh() { if (CostItems == null) { return; } if (!CostItems.Any()) { return; } //------------------------------------------------- //Shop Material Cost=Material + var t00 = CostItems.Where(x => x.TypeID == (int)NEstCostType.ShopMaterail).ToList(); var marterialCostShopOriginal = t00.Count == 0 ? 0 : t00.Sum(x => x.SubTotal); marterialCostShopOriginal = marterialCostShopOriginal * CostParameter.Configuration.MarkupShopMaterial; marterialCostShopOriginal = marterialCostShopOriginal * CostParameter.Configuration.MaterialWastageRate; //Other and Subcontract var t00a = CostItems.Where(x => x.TypeID == (int)NEstCostType.ShopOther || x.TypeID == (int)NEstCostType.ShopSubcontract) .ToList(); var materialCostShopSubcontractAndOther = t00a.Count == 0 ? 0 : t00a.Sum(x => x.SubTotal); var materialCostShop = (marterialCostShopOriginal + materialCostShopSubcontractAndOther) * CostParameter.Configuration.MaterialMarkupPercentage; var name01 = "Shop Material Cost (x" + MyConvert.ConvertToString(CostParameter.Configuration.MaterialMarkupPercentage) + ")"; name01 += " (x"; name01 += MyConvert.ConvertToString(CostParameter.Configuration.MarkupShopMaterial) + ")"; var summary01 = new CR_Cost_Summary { Name = name01, ProjectID = CostParameter.ProjectID, EstRevID = CostParameter.EstRevID, EstItemID = CostParameter.EstItemID, WorkorderID = CostParameter.WorkorderID, WorkorderItemID = CostParameter.WorkorderItemID, OrderNumber = 1, Column0 = "", Column1 = "", Column2 = (materialCostShop).ToString("C0"), TypeID = (int)NEstCostSummaryType.PriceA, }; //------------------------------------------------- var t01 = CostItems.Where(x => x.TypeID == (int)NEstCostType.ShopLabour).ToList(); var labourHourShop = t01.Count == 0 ? 0 : t01.Sum(x => x.Qty); var labourCostShop = CostParameter.Configuration.LabourRateShop * labourHourShop; var summary02 = new CR_Cost_Summary { Name = "Shop Labour Cost ($" + Convert.ToString(CostParameter.Configuration.LabourRateShop) + ")", ProjectID = CostParameter.ProjectID, EstRevID = CostParameter.EstRevID, EstItemID = CostParameter.EstItemID, WorkorderID = CostParameter.WorkorderID, WorkorderItemID = CostParameter.WorkorderItemID, OrderNumber = 2, Column0 = "", Column1 = "", Column2 = (labourCostShop).ToString("C0"), TypeID = (int)NEstCostSummaryType.PriceA, }; //------------------------------------------------- var modifyRate = Convert.ToDouble(CostParameter.Configuration.DiscountRate); var modifyRateString = " (" + MyConvert.ConvertDoubleToPercentage(CostParameter.Configuration.DiscountRate) + ")"; var t0b = CostItems.Where(x => x.TypeID == (int)NEstCostType.ShopStandItem).ToList(); var shopStandardItem = t0b.Count == 0 ? 0 : t0b.Sum(x => x.SubTotal); shopStandardItem = shopStandardItem * CostParameter.Configuration.MarkupStandardItem; // var name1 = "Supply Only Cost"; if (Math.Abs(modifyRate - 0) > 0.001) { name1 += modifyRateString; } var supplyOnlyCost = (materialCostShop + labourCostShop) * (1 + CostParameter.Configuration.DiscountRate) + shopStandardItem; var summary11 = new CR_Cost_Summary { Name = name1, ProjectID = CostParameter.ProjectID, EstRevID = CostParameter.EstRevID, EstItemID = CostParameter.EstItemID, WorkorderID = CostParameter.WorkorderID, WorkorderItemID = CostParameter.WorkorderItemID, OrderNumber = 11, Column0 = "", Column1 = "", Column2 = (supplyOnlyCost).ToString("C0"), TypeID = (int)NEstCostSummaryType.PriceA, }; //------------------------------------------------- //Installation var t2A = CostItems.Where(x => x.TypeID == (int)NEstCostType.InstallationTraveling).ToList(); var travellingHours = t2A.Count == 0 ? 0 : t2A.Sum(x => x.Qty); var travellingCost = MyConvert.ConvertToDouble(travellingHours * CostParameter.Configuration.LabourRateInstallation * (1 + CostParameter.Configuration.DiscountRate)); var summary12Name = "Travelling Cost" + "($" + Convert.ToString(CostParameter.Configuration.LabourRateInstallation) + ")"; if (Math.Abs(modifyRate - 0) > 0.001) { summary12Name += modifyRateString; } var summary12 = new CR_Cost_Summary { Name = summary12Name, ProjectID = CostParameter.ProjectID, EstRevID = CostParameter.EstRevID, EstItemID = CostParameter.EstItemID, WorkorderID = CostParameter.WorkorderID, WorkorderItemID = CostParameter.WorkorderItemID, OrderNumber = 12, Column0 = "", Column1 = "", Column2 = travellingCost.ToString("C0"), TypeID = (int)NEstCostSummaryType.PriceA, }; //------------------------------------------------- var t3A = CostItems.Where(x => x.TypeID == (int)NEstCostType.InstallationLabour).ToList(); var installHours = t3A.Count == 0 ? 0 : t3A.Sum(x => x.Qty); var installHoursCost = MyConvert.ConvertToDouble(installHours * CostParameter.Configuration.LabourRateInstallation); //Material var t3B = CostItems.Where(x => x.TypeID == (int)NEstCostType.InstallationMaterail).ToList(); var installationMaterialOriginalCost = t3B.Count == 0 ? 0 : t3B.Sum(x => x.SubTotal); installationMaterialOriginalCost = installationMaterialOriginalCost * CostParameter.Configuration.MarkupInstallationMaterial; installationMaterialOriginalCost = installationMaterialOriginalCost * CostParameter.Configuration.MaterialWastageRate; var t3c = CostItems.Where(x => x.TypeID == (int)NEstCostType.InstallationOther).ToList(); var installationOtherCost = t3c.Count == 0 ? 0 : t3c.Sum(x => x.SubTotal); var t3D = CostItems.Where(x => x.TypeID == (int)NEstCostType.InstallationEquipment).ToList(); var installationEquipmentCost = t3D.Count == 0 ? 0 : t3D.Sum(x => x.SubTotal); var installationCost = installHoursCost + (installationMaterialOriginalCost + installationOtherCost) * CostParameter.Configuration.MaterialMarkupPercentage * (1 + CostParameter.Configuration.DiscountRate) + installationEquipmentCost; var summary13Name = "Installation Cost" + "($" + Convert.ToString(CostParameter.Configuration.LabourRateInstallation) + ")"; if (Math.Abs(modifyRate - 0) > 0.001) { summary13Name += modifyRateString; } var summary13 = new CR_Cost_Summary { Name = summary13Name, ProjectID = CostParameter.ProjectID, EstRevID = CostParameter.EstRevID, EstItemID = CostParameter.EstItemID, WorkorderID = CostParameter.WorkorderID, WorkorderItemID = CostParameter.WorkorderItemID, OrderNumber = 13, Column0 = "", Column1 = "", Column2 = (installationCost).ToString("C0"), TypeID = (int)NEstCostSummaryType.PriceA, }; //------------------------------------------------- var targetPrice = supplyOnlyCost + travellingCost + installationCost; var summary14 = new CR_Cost_Summary { Name = "Target Price A", ProjectID = CostParameter.ProjectID, EstRevID = CostParameter.EstRevID, EstItemID = CostParameter.EstItemID, WorkorderID = CostParameter.WorkorderID, WorkorderItemID = CostParameter.WorkorderItemID, OrderNumber = 14, Column0 = "", Column1 = "", Column2 = (targetPrice).ToString("C0"), TypeID = (int)NEstCostSummaryType.PriceA, }; Values = new List <CR_Cost_Summary>() { summary01, summary02, summary11, summary12, summary13, summary14 }; //To Update DbTable TotalPrice = targetPrice; }
public override string IsValidated() { var b = true; string validationResult = ""; var isCityOfToronto = false; //Leadtime if (BaseValue.Deadline <= DateTime.Today) { validationResult += "Lead time is 5 business days " + System.Environment.NewLine; b = false; } else { var endDate = Convert.ToDateTime(BaseValue.Deadline); if (MyDateTime.GetDiffHoursOfWeekday(DateTime.Today, endDate) < 24 * NLeadTime) { validationResult += "Lead time is 5 business days " + System.Environment.NewLine; b = false; } } if (MyConvert.ConvertToString(Value.OccupationTimeStart).Length < 3) { validationResult += "Occupation Start Time Required" + System.Environment.NewLine; b = false; } if (MyConvert.ConvertToString(Value.OccupationTimeEnd).Length < 3) { validationResult += "Occupation End Time Required" + System.Environment.NewLine; b = false; } // if (Value.TypeOfTruck == 0) { validationResult += "Please Fill out Type of Truck " + System.Environment.NewLine; b = false; } //Installation Address var msc = new MySalesJobMasterListCustomer(BaseValue.JobID); msc.SetInstallTo(); if (msc.CustomerID == 0) { validationResult += "No Installation Company Selected " + System.Environment.NewLine; b = false; } else { var mc = new MyCustomer(msc.CustomerID); var customer = mc.Value; if (MyConvert.ConvertToString(customer.ADDR_1).Length < 5) { validationResult += "No Installation Address " + System.Environment.NewLine; b = false; } if (MyConvert.ConvertToString(customer.CITY).Length < 3) { validationResult += "Landlord City Required " + System.Environment.NewLine; b = false; } else { isCityOfToronto = GetIsCityOfToronto(customer.CITY); } if (MyConvert.ConvertToString(customer.ZIPCODE).Length < 4) { validationResult += "Landlord Postcode Required " + System.Environment.NewLine; b = false; } } if (MyConvert.ConvertToString(Value.ForemanName).Length < 2) { validationResult += "Foreman Name Required" + System.Environment.NewLine; b = false; } if (MyConvert.ConvertToString(Value.ForemanPhone).Length < 9) { validationResult += "Foreman Name Required" + System.Environment.NewLine; b = false; } //301 Insurance 2 30 //302 Additional Insurance for City of Toronto 2 30 //Document Attached int docTypeID = 301; var docAttached = _db.PermitDocuments.Where(x => x.BaseAppID == BaseValue.BaseAppID & x.DocType == docTypeID).ToList(); if (!docAttached.Any( )) { var docType = _db.PermitDocumentTypes.Find(docTypeID); validationResult += "Document Required: " + docType.TypeName + System.Environment.NewLine; b = false; } //302 Additional Insurance for City of Toronto 2 30 if (isCityOfToronto) { docTypeID = 302; docAttached = _db.PermitDocuments.Where(x => x.BaseAppID == BaseValue.BaseAppID & x.DocType == docTypeID).ToList(); if (!docAttached.Any()) { var docType = _db.PermitDocumentTypes.Find(docTypeID); validationResult += "Document Required: " + docType.TypeName + System.Environment.NewLine; b = false; } } return(b ? "ok" : validationResult); }
public void ImportAddressFromCustomer(string importCustomerType) { //Subcontract-->Project-->IsInstallTo->Contact and Customer var workorder = new MyWorkorder(Value.WoID); var msc = new MySalesJobMasterListCustomer(workorder.Value.jobID); if (importCustomerType == "InstallTo") { msc.SetInstallTo(); } if (importCustomerType == "QuoteTo") { msc.SetQuoteTo(); } if (importCustomerType == "BillTo") { msc.SetBillTo(); } var mc = new MyCustomer(msc.CustomerID); _customer = mc.Value; var mcc = new MyCustomerContact(msc.ContactID); _contact = mcc.Value; if (_customer != null) { string addr = _customer.ADDR_1; if (!Convert.IsDBNull(_customer.ADDR_2)) { addr = addr + " " + _customer.ADDR_2; } Value.Address = addr; Value.City = _customer.CITY; Value.Postcode = _customer.ZIPCODE; Value.Province = _customer.STATE; Value.ShipToName = _customer.NAME; string attenName = MyConvert.ConvertToString(_contact.CONTACT_HONORIFIC) + " "; attenName += MyConvert.ConvertToString(_contact.CONTACT_FIRST_NAME) + " "; attenName += MyConvert.ConvertToString(_contact.CONTACT_LAST_NAME); Value.AttnName = attenName.Trim(); Value.AttnPhone = MyConvert.ConvertToString(_contact.CONTACT_PHONE); //For Delivery Note Value.DeliveryDate = DateTime.Today; Value.WorkorderNumber = workorder.Value.WorkorderNumber; var emp = new FsEmployee(Convert.ToInt32(workorder.Value.Sales)); Value.AeName = emp.NickName; Value.AePhone = emp.GetCompanyPhoneExtension(); Value.InvoiceNumber = workorder.GetInvoices(); Value.NoteTypeID = 0; _db.Entry(Value).State = EntityState.Modified; _db.SaveChanges(); Result = "ok"; } else { Result = "Could not find the specified Customer."; } }
public override string IsValidated() { var b = true; string validationResult = ""; //Number of Sign if (MyConvert.ConvertToDouble(Value.NumberOfSigns) == 0) { validationResult += "Number of Signs required." + System.Environment.NewLine; b = false; } //Estimated Value if (MyConvert.ConvertToDouble(Value.ProjectValueEstimated) == 0) { validationResult += "Estimated Project Valued required." + System.Environment.NewLine; b = false; } //Installation Address var msc = new MySalesJobMasterListCustomer(BaseValue.JobID); msc.SetInstallTo(); if (msc.CustomerID == 0) { validationResult += "No Installation Company Selected " + System.Environment.NewLine; b = false; } else { var mc = new MyCustomer(msc.CustomerID); if (MyConvert.ConvertToString(mc.Value.ADDR_1).Length < 5) { validationResult += "No Installation Address " + System.Environment.NewLine; b = false; } } //Landlord if (Value.LandlordID < 1000) { validationResult += "Enter a Landlord Please " + System.Environment.NewLine; b = false; } else { var landlord = _db.PermitLandlords.Find(Value.LandlordID); //Company Name if (MyConvert.ConvertToString(landlord.NAME).Length < 5) { validationResult += "Landlord Name Required" + System.Environment.NewLine; b = false; } //Address if (MyConvert.ConvertToString(landlord.ADDR_1).Length < 5) { validationResult += "Landlord Address Required " + System.Environment.NewLine; b = false; } if (MyConvert.ConvertToString(landlord.CITY).Length < 3) { validationResult += "Landlord City Required " + System.Environment.NewLine; b = false; } if (MyConvert.ConvertToString(landlord.ZIPCODE).Length < 4) { validationResult += "Landlord Postcode Required " + System.Environment.NewLine; b = false; } } //Landlord Contact if (Value.LandlordContactID < 1000) { validationResult += "Enter a Landlord Contact " + System.Environment.NewLine; b = false; } else { var contact = _db.PermitLandlordContacts.Find(Value.LandlordContactID); var l1 = MyConvert.ConvertToString(contact.CONTACT_FIRST_NAME).Length; var l2 = MyConvert.ConvertToString(contact.CONTACT_LAST_NAME).Length; if (l1 + l2 < 2) { validationResult += "Landlord Contact Name Required" + System.Environment.NewLine; b = false; } if (MyConvert.ConvertToString(contact.CONTACT_PHONE).Length < 9) { validationResult += "Landlord Contact Phone Required" + System.Environment.NewLine; b = false; } } //Document Attached var requiredDocuemntTypes = new int[] { 10, 12, 14, 16 }; for (int i = 0; i < requiredDocuemntTypes.Length; i++) { var docTypeID = requiredDocuemntTypes[i]; var docAttached = _db.PermitDocuments.Where(x => x.BaseAppID == BaseValue.BaseAppID & x.DocType == docTypeID).ToList(); if (!docAttached.Any( )) { var docType = _db.PermitDocumentTypes.Find(docTypeID); validationResult += "Document Required: " + docType.TypeName + System.Environment.NewLine; b = false; } } return(b ? "ok" : validationResult); }
private string IsValidated() { var b = true; string validationResult = ""; var msc = new MySalesJobMasterListCustomer(Value.JobID); msc.SetInstallTo(); if (msc.CustomerID < 1000) { validationResult += "No Installation Company Selected " + System.Environment.NewLine; b = false; } else { var myCustomer = new MyCustomer(msc.CustomerID); if (MyConvert.ConvertToString(myCustomer.Value.ADDR_1).Length < 5) { b = false; validationResult += "No Installation Address " + System.Environment.NewLine; } } if (Value.ContactPerson1 == 0) { validationResult += "Contact person required." + System.Environment.NewLine; b = false; } if (MyConvert.IsDate(Value.TargetDate)) { if (Value.TargetDate <= DateTime.Today) { validationResult += "Target Date should not be early than today. " + System.Environment.NewLine; b = false; } } else { validationResult += "Invalid Target Date format. " + System.Environment.NewLine; b = false; } if (!MyString.IsStringLengthLongerThan(3, Value.BudgetProvideBy)) { validationResult += "Budget Provide By Whom Required." + System.Environment.NewLine; b = false; } if (!MyString.IsStringLengthLongerThan(3, Value.Requirement)) { validationResult += "Please Enter Requirement." + System.Environment.NewLine; b = false; } var budgetAmount = 100; if (Value.RequirementID >= 6530) { budgetAmount = 100; //1 } if (Value.Budget < budgetAmount) { validationResult += "Normal Job Budget should >=$100, other Job Budget >=$100 " + System.Environment.NewLine; b = false; } return(b ? "ok" : validationResult); }