public ReceivingMastersResponse GetMastersForReceiving(JObject input) { ReceivingMastersResponse objresponse = new ReceivingMastersResponse(); try { objresponse = objBookingBal.GetMastersForReceiving(input); } catch (Exception ex) { objresponse.StatusId = 0; objresponse.StatusMessage = ex.Message; } return(objresponse); }
public ReceivingMastersResponse GetMastersForReceiving(JObject input) { ReceivingMastersResponse objresponse = new ReceivingMastersResponse(); try { DataSet ds = new DataSet(); int counterid = Convert.ToInt32(CommonMethods.URLKeyDecrypt(Convert.ToString(input["CounterId"]))); int loginid = Convert.ToInt32(CommonMethods.URLKeyDecrypt(Convert.ToString(input["LoginId"]))); ds = objBookingDal.GetMastersForReceiving(counterid, loginid); if (ds != null) { if (ds.Tables.Count > 0) { var gctypes = ds.Tables[0].AsEnumerable().Where(a => a.Field <int>("MasterType") == 1). Select(x => new GCTypesResponse { GCTypeId = x.Field <int>("Id"), GCType = x.Field <string>("Name") }).ToList(); objresponse.GCTypes = gctypes; var counters = ds.Tables[0].AsEnumerable().Where(a => a.Field <int>("MasterType") == 2). Select(x => new CounterMastersResponse { CounterId = x.Field <int>("Id"), CounterName = x.Field <string>("Name") }).ToList(); objresponse.Counters = counters; var receivingtypes = ds.Tables[0].AsEnumerable().Where(a => a.Field <int>("MasterType") == 3). Select(x => new ReceivingTypesResponse { ReceivingTypeId = x.Field <int>("Id"), ReceivingTypeName = x.Field <string>("Name") }).ToList(); objresponse.ReceivingTypes = receivingtypes; if (ds.Tables[1] != null) { var producttypes = ds.Tables[1].AsEnumerable(). Select(x => new ProductTypesResponse { ProductTypeId = x.Field <int>("Id"), ProductType = x.Field <string>("Name"), GCTypeId = x.Field <Nullable <int> >("GCTypeId") }).ToList(); objresponse.ProductTypes = producttypes; } objresponse.StatusId = 1; objresponse.StatusMessage = "Valid"; } } } catch (Exception ex) { objresponse.StatusId = 0; objresponse.StatusMessage = ex.Message; } return(objresponse); }