Esempio n. 1
0
        public LabourDetails GetLabourList()
        {
            LabourDetails labourDetails = new LabourDetails();
            Labour labour;
            SupplierDAL supplierDAL = new SupplierDAL();
            try
            {
                DataTable dt = supplierDAL.GetLaboursList();
                if (dt.Rows.Count > 0)
                {

                    foreach (DataRow dr in dt.Rows)
                    {
                        labour = new Labour();
                        labour.CurrentPincode = Convert.ToInt32(dr["CurrentPincode"] == null ? 0 : dr["CurrentPincode"]);
                        labour.Doc1_URL = dr["Doc1_URL"].ToString().TrimStart('.');
                        labour.Doc2_URL = dr["Doc2_URL"].ToString().TrimStart('.');
                        labour.Doc3_URL = dr["Doc3_URL"].ToString().TrimStart('.');
                        labour.Doc4_URL = dr["Doc4_URL"].ToString().TrimStart('.');
                        labour.Experience = Convert.ToInt32(dr["Experience"] == null ? 0 : dr["Experience"]);
                        labour.FullName = dr["FullName"].ToString();
                        labour.Image_URL = dr["Image_URL"].ToString().TrimStart('.');
                        labour.LabourCode = dr["LabourCode"].ToString();
                        labour.LabourID = Convert.ToInt32(dr["Experience"] == null ? 0 : dr["Experience"]);
                        labour.LabourType = dr["LabourType"].ToString();
                        labour.Lbr_Skill = dr["Lbr_Skill"].ToString();
                        labour.SectorType = dr["SectorType"].ToString();
                        labour.Specialization = dr["Specialization"].ToString();
                        labour.SupplierID = Convert.ToInt32(dr["SupplierID"] == null ? 0 : dr["SupplierID"]);
                        labour.SupplierName = dr["SupplierName"].ToString();
                        string Verification = dr["Verification"] == null ? "0" : dr["Verification"].ToString();
                        labour.Verification = Verification == "1" ? true : false;
                        labour.Wages = Convert.ToInt32(dr["Wages"] == null ? 0 : dr["Wages"]);
                        labourDetails.Data.Add(labour);
                    }
                    labourDetails.ApplicationUrl = ConfigurationManager.AppSettings["ApplicationUrl"].ToString();//"http://dev.easylabour.com";
                    labourDetails.Count = dt.Rows.Count;
                    labourDetails.Status = true;
                    labourDetails.Message = "List of Labours !";
                }
                else
                {
                    labourDetails.Status = false;
                    labourDetails.Message = "No Labour exists !";
                }
            }
            catch (Exception exception)
            {
                labourDetails.Status = false;
                labourDetails.Message = "Opps something went worng, please check with application admin !";
                Logger Err = new Logger();
                Err.ErrorLog(HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["ErrorLogPath"]), exception.Message, exception.StackTrace);
            }
            return labourDetails;
        }