public static CurrentDayPickup GetOneCDP(int?cdpkey) { // return (CurrentDayPickup.All().Where(x => (x.CurrentDayPickupID == key))).FirstOrDefault(); var name = "GETOneCDP(int? cdpkey"; if (cdpkey.HasValue) { return(CurrentDayPickup.Find(x => x.CurrentDayPickupID == cdpkey.Value).First()); } else { CurrentDayPickup cdp = CurrentDayPickup.Find(x => x.CurrentDayPickupID == cdpkey.Value).DefaultIfEmpty( new CurrentDayPickup { CDPCustomerID = "QQQQQ", CDPCustomerName = name, CDPDispatched = false, CDPChecked = false, CDPDeleted = false, CDPSent = false, CDPSendConfirmed = false }).First(); return(cdp); } }
public static List <CurrentDayPickup> ListPickupsForThisCustomer(string custID) { return((CurrentDayPickup.All() .Where(pp => (pp.CDPCustomerID == custID && !pp.CDPDeleted))) .ToList()); }
public static List <CurrentDayPickup> GetPickupsForThisRoute(string tag) { var p = (from pp in CurrentDayPickup.All() where (pp.CDPDefaultRouteID == tag && pp.CDPDeleted == false) select pp); return(p.ToList()); }
public static bool CompareNewCDP(CurrentDayPickup currentDayPickup, Posting posting) { var pu = Helper.GetOneCDP(currentDayPickup.CurrentDayPickupID); return(pu.Equals(currentDayPickup)); }
public static int GetUndeletedPickupCount() { return(CurrentDayPickup.All().Where(x => x.CDPDeleted == false).Count()); }
public static List <CurrentDayPickup> GetCDPList() { return((from p in CurrentDayPickup.All() select p).ToList()); }
public static bool HasCDP(string custID) { return(CurrentDayPickup.Exists(x => (!x.CDPDeleted && x.CDPCustomerID == custID))); }
/// <summary> /// This routine implements the primary functionality of this window. /// calls pickup.save(), ReFreshThisRoute() /// </summary> /// <remarks> /// triggered by CRLF in txtComment control /// </remarks> public void AddPickup() { //calls pu.save() string strCustomerName = null; string strComment = " "; string strCDPSyncID = null; int i = 0; lblCustomerName.Text =lblCustomerName.Text == null ? "" : lblCustomerName.Text; txtComment.Text =txtComment.Text == null ? "" : txtComment.Text; txtComment.Text =txtComment.Text == null ? "" : txtComment.Text; strComment =txtComment.Text; // force the comment to be only 30 chars long. // the database column is only that wide. if (strComment.Length > 30) { var sb = new StringBuilder(); sb.AppendLine("Only 30 characters allowed") sb.AppendLine("Discarding: " + strComment.Substring(31)); Strings.Mid(strComment, 31)); MessageBox.Show("Only 30 characters allowed" + Constants.vbCrLf + "Discarding: " + Strings.Mid(strComment, 31)); strComment = Strings.Mid(strComment, 1, 30); } intCDPSyncCount += 1; strCDPSyncID = Environment.MachineName + "_Pkp_" + intCDPSyncCount.ToString; CurrentDayPickup pu = new CurrentDayPickup(); pu.CDPSyncID = strCDPSyncID; pu.CDPCustomerName = strCustomerName; // use the hidden one here pu.CDPCustomerID = pnlCustomerDetails.Controls.Item("lblOrigCustID").Text; //pu.CDPCustomerID = txtCustomerID.Text pu.CDPComment = strComment; pu.CDPPickupDate = Today; pu.CDPDefaultRouteID = txtDefaultRoute.Text; pu.CDPDispatched = false; pu.CDPStation = Environment.MachineName; pu.CDPChecked = false; pu.UserName = Environment.UserName; pu.PostedCount = My.MySettings.Default.ActiveStations - 1; pu.Terminal = My.MySettings.Default.Terminal; pu.CDPCreatedBy = Environment.MachineName; pu.CDPCreatedTime = Now; pu.CDPEditedBy = ""; pu.Save(); // post it int pendingUpdates = My.MySettings.Default.ActiveStations - 1; string initiatingUser = Environment.UserName; Posting job = new Posting(pu, pendingUpdates, initiatingUser); job.Save(); //Me.ParentForm.MdiChildren(0).Tag frmRoute frm = default(frmRoute); for (i = 0; i <= this.ParentForm.MdiChildren.Length - 1; i++) { if (((this.ParentForm.MdiChildren(i)) is TabForm | (this.ParentForm.MdiChildren(i)) is InputForm)) { continue; } if ((txtDefaultRoute.Text == this.ParentForm.MdiChildren(i).Text.Substring(0, 2))) { frm = this.ParentForm.MdiChildren(i); frm.RefreshDynamicPickupControls(); //MainWindow.RefreshThisRoute(frm) ' sometimes threw an exception break; // TODO: might not be correct. Was : Exit For } } //ClearCustomerInfo() txtComment.Text = ""; txtCustomerID.Text = ""; txtCustomerID.Focus(); }