private List <GRNListBLL> MergeWithClient(List <GRNBLL> list) { //Get Client list. List <GRNListBLL> grnList = new List <GRNListBLL>(); List <ClientBLL> ClientList = new List <ClientBLL>(); ClientList = ClientBLL.GetAllClient(); if (ClientList == null) { throw new ClientInformationException("Can not get Clinet Information"); } else { var q = from GRN in list join client in ClientList on GRN.ClientId equals client.ClientUniqueIdentifier select new { GRN.Id, GRN.GRN_Number, GRN.CommodityId, GRN.CommodityClassId, GRN.CommodityGradeId, GRN.Status, GRN.OriginalQuantity, GRN.DateDeposited, client.ClientName }; foreach (var i in q) { GRNListBLL obj = new GRNListBLL(); obj.Id = i.Id; obj.GRN = i.GRN_Number; obj.CommodityId = i.CommodityId; obj.CommodityClassId = i.CommodityClassId; obj.CommodityGradeId = i.CommodityGradeId; obj.Status = (GRNStatus)i.Status; obj.ClinetName = i.ClientName; obj.OriginalQuantity = i.OriginalQuantity; obj.DateDeposited = Convert.ToDateTime(i.DateDeposited.ToShortDateString()); obj.CommodityGrade = CommodityGradeBLL.GetCommodityGradeNameById(i.CommodityGradeId); grnList.Add(obj); } return(grnList); } }
public List <GRNListBLL> Search(string GRN, string TrackingNo, Nullable <Guid> ClientId, Nullable <Guid> CommodityId, Nullable <Guid> CommoidtyClassId, Nullable <Guid> CommodityGradeId, Nullable <GRNStatus> Status, Nullable <DateTime> From, Nullable <DateTime> To) { List <GRNListBLL> lstGRNlist = null; List <GRNBLL> GRNlist = new List <GRNBLL>(); // check search parameters are there. if ((string.IsNullOrEmpty(GRN) == true) && (string.IsNullOrEmpty(TrackingNo) == true) && (ClientId == null) && (CommodityId == null) && (CommoidtyClassId == null) && (CommodityGradeId == null) && (Status == null) && (From == null) && (To == null)) { throw (new NULLSearchParameterException("No Search parameter")); } GRNlist = GRNDAL.Search(GRN, TrackingNo, ClientId, CommodityId, CommodityClassId, CommodityGradeId, Status, From, To); if (GRNlist != null) { if (GRNlist.Count > 0) { lstGRNlist = new List <GRNListBLL>(); GRNListBLL oblGRNList = new GRNListBLL(); foreach (GRNBLL o in GRNlist) { GRNListBLL obj = new GRNListBLL(); obj.Id = o.Id; obj.GRN = o.GRN_Number; obj.CommodityId = o.CommodityId; obj.CommodityClassId = o.CommodityClassId; obj.CommodityGradeId = o.CommodityGradeId; obj.Status = (GRNStatus)o.Status; obj.ClinetName = ClientBLL.GetClinetNameById(o.ClientId); obj.OriginalQuantity = o.OriginalQuantity; obj.DateDeposited = Convert.ToDateTime(o.DateDeposited.ToShortDateString()); lstGRNlist.Add(obj); } } else { return(null); } } return(lstGRNlist); }