public BookingMastersResponse GetMasters(JObject input) { BookingMastersResponse objresponse = new BookingMastersResponse(); try { objresponse = objBookingBal.GetMastersForBooking(input); } catch (Exception ex) { objresponse.StatusId = 0; objresponse.StatusMessage = ex.Message; } return(objresponse); }
public BookingMastersResponse GetMastersForBooking(JObject input) { BookingMastersResponse objresponse = new BookingMastersResponse(); 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.GetMastersForBooking(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 parceltypes = ds.Tables[0].AsEnumerable().Where(a => a.Field <int>("MasterType") == 3). Select(x => new ParcelTypesResponse { ParcelTypeId = x.Field <int>("Id"), ParcelType = x.Field <string>("Name") }).ToList(); objresponse.ParcelTypes = parceltypes; var producttypes = ds.Tables[0].AsEnumerable().Where(a => a.Field <int>("MasterType") == 4). Select(x => new ProductTypesResponse { ProductTypeId = x.Field <int>("Id"), ProductType = x.Field <string>("Name") }).ToList(); objresponse.ProductTypes = producttypes; var books = ds.Tables[0].AsEnumerable().Where(a => a.Field <int>("MasterType") == 5). Select(x => new BooksMasterResponse { BookId = x.Field <int>("Id"), BookName = x.Field <string>("Name") }).ToList(); objresponse.Books = books; var customers = ds.Tables[0].AsEnumerable().Where(a => a.Field <int>("MasterType") == 6). Select(x => new CustomersMasterResponse { CustomerId = x.Field <int>("Id"), MobileNumber = x.Field <string>("Name") }).ToList(); objresponse.Customers = customers; var paidtypes = ds.Tables[0].AsEnumerable().Where(a => a.Field <int>("MasterType") == 7). Select(x => new PaidTypesMasterResponse { PaidTypeId = x.Field <int>("Id"), PaidTypeName = x.Field <string>("Name") }).ToList(); objresponse.PaidTypes = paidtypes; objresponse.StatusId = 1; objresponse.StatusMessage = "Valid"; } } } catch (Exception ex) { objresponse.StatusId = 0; objresponse.StatusMessage = ex.Message; } return(objresponse); }