예제 #1
0
        public List <Grn> Search()
        {
            List <Grn> GrnList = new List <Grn>();

            System.Data.DataTable dTable = new DataTable();
            try
            {
                string errorMessage = string.Empty;
                dTable = GetSelectedRecords(Common.ToXml(this), SP_GRN_SEARCH, ref errorMessage);

                if (dTable != null)
                {
                    foreach (System.Data.DataRow drow in dTable.Rows)
                    {
                        Grn _grn = CreateGRNObject(drow);
                        GrnList.Add(_grn);
                    }
                }
                return(GrnList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
 private Grn CreateGRNObject(DataRow dr)
 {
     try
     {
         Grn grn = new Grn();
         grn.AmendmentNo             = Convert.ToInt32(dr[CON_FIELD_AMENDMENTNO]);
         grn.ChallanDate             = Convert.ToString(dr[CON_FIELD_CHALLANDATE]);
         grn.ChallanNo               = Convert.ToString(dr[CON_FIELD_CHALLANNO]);
         grn.CreatedBy               = Convert.ToInt32(dr[CON_FIELD_CREATEDBY]);
         grn.GrossWeight             = Convert.ToString(dr[CON_FIELD_GROSSWEIGHT]);
         grn.GRNDate                 = Convert.ToString(dr[CON_FIELD_GRNDATE]);
         grn.GRNNo                   = Convert.ToString(dr[CON_FIELD_GRNNO]);
         grn.InvoiceDate             = Convert.ToString(dr[CON_FIELD_INVOICEDATE]);
         grn.InvoiceNo               = Convert.ToString(dr[CON_FIELD_INVOICENO]);
         grn.ModifiedBy              = Convert.ToInt32(dr[CON_FIELD_MODIFYBY]);
         grn.ModifiedDate            = Convert.ToDateTime(dr[CON_FIELD_MODIFYDATE]);
         grn.NoOfBoxes               = Convert.ToInt32(dr[CON_FIELD_NOOFBOXES]);
         grn.PODate                  = Convert.ToString(dr[CON_FIELD_PODATE]);
         grn.PONumber                = Convert.ToString(dr[CON_FIELD_PONUMBER]);
         grn.ReceivedBy              = Convert.ToString(dr[CON_FIELD_RECEIVEDBY]);
         grn.ShippingDetails         = Convert.ToString(dr[CON_FIELD_SHIPPINGDETAILS]);
         grn.Status                  = Convert.ToInt32(dr[CON_FIELD_STATUS]);
         grn.StatusName              = Convert.ToString(dr[CON_FIELD_STATUSNAME]);
         grn.VehicleNo               = Convert.ToString(dr[CON_FIELD_VEHICLENO]);
         grn.VendorCode              = Convert.ToString(dr[CON_FIELD_VENDORCODE]);
         grn.VendorName              = Convert.ToString(dr[CON_FIELD_VENDORNAME]);
         grn.InvoiceAmount           = Convert.ToDouble(dr[CON_FIELD_INVOICEAMOUNT]);
         grn.InvoiceTaxAmount        = Convert.ToDouble(dr[CON_FIELD_INVOICETAX]);
         grn.DestinationLocationCode = Convert.ToString(dr[CON_FIELD_LOCATIONCODE]);
         Address _address = new Address();
         _address.Address1 = Convert.ToString(dr[CON_FIELD_LOCATIONCODE]);
         if (dr.Table.Columns.Contains(CON_FIELD_D_ADDRESS1))
         {
             _address.Address1 = Convert.ToString(dr[CON_FIELD_D_ADDRESS1]);
         }
         if (dr.Table.Columns.Contains(CON_FIELD_D_ADDRESS2))
         {
             _address.Address2 = Convert.ToString(dr[CON_FIELD_D_ADDRESS2]);
         }
         if (dr.Table.Columns.Contains(CON_FIELD_D_ADDRESS3))
         {
             _address.Address3 = Convert.ToString(dr[CON_FIELD_D_ADDRESS3]);
         }
         if (dr.Table.Columns.Contains(CON_FIELD_D_ADDRESS4))
         {
             _address.Address4 = Convert.ToString(dr[CON_FIELD_D_ADDRESS4]);
         }
         if (dr.Table.Columns.Contains(CON_FIELD_D_CITYNAME))
         {
             _address.City = Convert.ToString(dr[CON_FIELD_D_CITYNAME]);
         }
         if (dr.Table.Columns.Contains(CON_FIELD_D_CITY))
         {
             _address.CityId = Convert.ToInt32(dr[CON_FIELD_D_CITY]);
         }
         if (dr.Table.Columns.Contains(CON_FIELD_D_COUNTRYNAME))
         {
             _address.Country = Convert.ToString(dr[CON_FIELD_D_COUNTRYNAME]);
         }
         if (dr.Table.Columns.Contains(CON_FIELD_D_COUNTRY))
         {
             _address.CountryId = Convert.ToInt32(dr[CON_FIELD_D_COUNTRY]);
         }
         if (dr.Table.Columns.Contains(CON_FIELD_D_EMAIL1))
         {
             _address.Email1 = Convert.ToString(dr[CON_FIELD_D_EMAIL1]);
         }
         if (dr.Table.Columns.Contains(CON_FIELD_D_EMAIL2))
         {
             _address.Email2 = Convert.ToString(dr[CON_FIELD_D_EMAIL2]);
         }
         if (dr.Table.Columns.Contains(CON_FIELD_D_FAX1))
         {
             _address.Fax1 = Convert.ToString(dr[CON_FIELD_D_FAX1]);
         }
         if (dr.Table.Columns.Contains(CON_FIELD_D_FAX2))
         {
             _address.Fax2 = Convert.ToString(dr[CON_FIELD_D_FAX2]);
         }
         if (dr.Table.Columns.Contains(CON_FIELD_D_MOBILE1))
         {
             _address.Mobile1 = Convert.ToString(dr[CON_FIELD_D_MOBILE1]);
         }
         if (dr.Table.Columns.Contains(CON_FIELD_D_MOBILE2))
         {
             _address.Mobile2 = Convert.ToString(dr[CON_FIELD_D_MOBILE2]);
         }
         if (dr.Table.Columns.Contains(CON_FIELD_D_PHONE1))
         {
             _address.PhoneNumber1 = Convert.ToString(dr[CON_FIELD_D_PHONE1]);
         }
         if (dr.Table.Columns.Contains(CON_FIELD_D_PHONE2))
         {
             _address.PhoneNumber2 = Convert.ToString(dr[CON_FIELD_D_PHONE2]);
         }
         if (dr.Table.Columns.Contains(CON_FIELD_D_PINCODE))
         {
             _address.PinCode = Convert.ToString(dr[CON_FIELD_D_PINCODE]);
         }
         if (dr.Table.Columns.Contains(CON_FIELD_D_STATENAME))
         {
             _address.State = Convert.ToString(dr[CON_FIELD_D_STATENAME]);
         }
         if (dr.Table.Columns.Contains(CON_FIELD_D_STATE))
         {
             _address.StateId = Convert.ToInt32(dr[CON_FIELD_D_STATE]);
         }
         if (dr.Table.Columns.Contains(CON_FIELD_D_WEBSITE))
         {
             _address.Website = Convert.ToString(dr[CON_FIELD_D_WEBSITE]);
         }
         grn.DestinationLocation = _address.GetAddress().ToString();
         return(grn);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }