public static List <CPOSummaryHead> GetChangeList(User user) { List <CPOSummaryHead> ret = new List <CPOSummaryHead>(); DBConnect connection = new DBConnect(); try { connection.Connect(ConnectionsMgr.GetSHConnInfo(user, _Database.ECGB)); var queryCPOHead = connection.Select(new[] { _Column.UniqueKey, _Column.PONumber, _Column.POChangeDate, _Column.Purpose, _Column.TotalItems, _Column.HProcessed }, _Table.Head860, string.Format("WHERE {0}='{1}' AND {2}='{3}' AND ({4}='{5}' OR {4}='{6}')", _Column.Customer, user.Customer, _Column.Partner, user.ActivePartner, _Column.HProcessed, _ProgressFlag.Unprocessed, _ProgressFlag.Error)); while (queryCPOHead.Read()) { CPOSummaryHead newHead = new CPOSummaryHead(); newHead.UniqueKey = queryCPOHead.Field(0, ""); newHead.PONumber = queryCPOHead.Field(1, ""); newHead.POChangeDate = queryCPOHead.Field(2, ""); newHead.Purpose = ElementLookup.GetDesc(user, _Element.Purpose, queryCPOHead.Field(3, "")); newHead.Affected = queryCPOHead.Field(4, ""); newHead.Status = queryCPOHead.Field(5, ""); newHead.Details = new List <CPOSummaryDetail>(); var queryCPODetail = connection.Select(new[] { _Column.ChangeType, _Column.Quantity, _Column.ChangeQuantity, _Column.UnitPrice, _Column.RetailPrice, _Column.UPCNum, _Column.VendorNum, _Column.ItemDesc, _Column.PackSize, _Column.Dropship, _Column.Processed }, _Table.Detail860, string.Format("WHERE {0}='{1}'", _Column.UniqueKey, newHead.UniqueKey)); while (queryCPODetail.Read()) { CPOSummaryDetail newDetail = new CPOSummaryDetail(); newDetail.ChangeType = ElementLookup.GetDesc(user, _Element.ChangeType, queryCPODetail.Field(0, "")); newDetail.Quantity = decimal.Parse(queryCPODetail.Field(1, "0")).ToString("N0"); newDetail.ChangeQuantity = decimal.Parse(queryCPODetail.Field(2, "0")).ToString("N0"); newDetail.UnitPrice = queryCPODetail.Field(3, ""); newDetail.RetailPrc = queryCPODetail.Field(4, ""); newDetail.UPC = queryCPODetail.Field(5, ""); newDetail.VendorNum = queryCPODetail.Field(6, ""); newDetail.ItemDesc = queryCPODetail.Field(7, ""); newDetail.PackSize = queryCPODetail.Field(8, ""); newDetail.Dropship = queryCPODetail.Field(9, "").Replace('\r', ' '); newDetail.Status = queryCPODetail.Field(10, ""); newHead.Details.Add(newDetail); } ret.Add(newHead); } return(ret.OrderBy(h => h.POChangeDate).ThenBy(h => h.PONumber).ThenBy(h => h.Purpose).ToList()); } catch (Exception e) { connection.Close(); ProgramLog.LogError(user, "ChangePOTracker", "GetChangeList", e.Message); return(new List <CPOSummaryHead>()); } }
protected void SetDevelopmentInfo(User user) { DatabaseInfo di = null; string sFormat = "{1} ({0})"; List <string> conns = new List <string>(); di = ConnectionsMgr.GetOCConnInfo(user); conns.Add(string.Format(sFormat, di.Port, di.Id)); di = ConnectionsMgr.GetNPConnInfo(user); conns.Add(string.Format(sFormat, di.Port, di.Id)); di = ConnectionsMgr.GetSHConnInfo(user); conns.Add(string.Format(sFormat, di.Port, di.Id)); di = ConnectionsMgr.GetSLConnInfo(user); conns.Add(string.Format(sFormat, di.Port, di.Id)); lblDeNotice.Text = string.Format("Development Environment: {0}", string.Join(", ", conns)); divDeNotice.Visible = true; }
private static ResponseType Cancel860(User user, string sHeadUniqueKey860) { DBConnect connection = new DBConnect(); try { connection.Connect(ConnectionsMgr.GetSHConnInfo(user, _Database.ECGB)); UpdateAll860ProcFlags(connection, sHeadUniqueKey860, _ProgressFlag.Canceled); connection.Close(); return(ResponseType.SuccessCPO); } catch (Exception e) { connection.Close(); ProgramLog.LogError(user, "ChangePOTracker", "Cancel860", e.Message); return(ResponseType.ErrorCPOUnknown); } }