예제 #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;
        }
예제 #2
0
        public LabourDetails InsertLabour(string FullName, string FatherName, string CurrentAddress, string CurrentStateID, string CurrentCityID, string CurrentPincode, string PermanentAddress, string PermanentStateID, string PermanentCityID, string PermanentPincode, string PhoneNo, string SectorType, string LabourType, string Specialization, string Experience, string Wages, string Lbr_Skill, string Bool_Verification, string SupplierID, string Belonging1, string Belonging2, string Belonging3, string Belonging4)
        {
            LabourDetails labourDetails = new LabourDetails();
            Labour labour = new Labour();
            SupplierDAL supplierDAL = new SupplierDAL();
            System.Net.WebHeaderCollection webHeaderCollection = WebOperationContext.Current.IncomingRequest.Headers;
            try
            {
                #region Url Decoding...
                FullName = HttpUtility.UrlDecode(FullName);
                FatherName = HttpUtility.UrlDecode(FatherName);
                CurrentAddress = HttpUtility.UrlDecode(CurrentAddress);
                CurrentStateID = HttpUtility.UrlDecode(CurrentStateID);
                CurrentCityID = HttpUtility.UrlDecode(CurrentCityID);
                CurrentPincode = HttpUtility.UrlDecode(CurrentPincode);
                PermanentAddress = HttpUtility.UrlDecode(PermanentAddress);
                PermanentStateID = HttpUtility.UrlDecode(PermanentStateID);
                PermanentCityID = HttpUtility.UrlDecode(PermanentCityID);
                PermanentPincode = HttpUtility.UrlDecode(PermanentPincode);
                PhoneNo = HttpUtility.UrlDecode(PhoneNo);
                SectorType = HttpUtility.UrlDecode(SectorType);
                LabourType = HttpUtility.UrlDecode(LabourType);
                Specialization = HttpUtility.UrlDecode(Specialization);
                Experience = HttpUtility.UrlDecode(Experience);
                Wages = HttpUtility.UrlDecode(Wages);
                Lbr_Skill = HttpUtility.UrlDecode(Lbr_Skill);
                Bool_Verification = HttpUtility.UrlDecode(Bool_Verification);
                SupplierID = HttpUtility.UrlDecode(SupplierID);
                Belonging1 = HttpUtility.UrlDecode(Belonging1);
                Belonging2 = HttpUtility.UrlDecode(Belonging2);
                Belonging3 = HttpUtility.UrlDecode(Belonging3);
                Belonging4 = HttpUtility.UrlDecode(Belonging4);
                #endregion

                #region Labour Code Generate
                string Sector = "";
                string LabourTypeCurrentCityPreFix = supplierDAL.GetLabourTypeCityPreFixCode(LabourType, CurrentCityID);
                //string CurrentCityPreFix = "";

                string CodePostFix = SupplierDAL.GenerateCodeWithLeftPad("tbl_LabourRegistration", "Reg_ID", 6, "", false);
                if (SectorType == "1")
                    Sector = "HH";
                else if (SectorType == "2")
                    Sector = "GL";
                else
                    Sector = "IL";
                string CodePrefix = Sector + LabourTypeCurrentCityPreFix + CurrentPincode.Substring(4, 2);
                string LabourCode = CodePrefix + CodePostFix;
                #endregion

                labour.LabourCode = LabourCode.ToUpper() == "NULL" ? "" : LabourCode;
                labour.FullName = FullName.ToUpper() == "NULL" ? "" : FullName;
                labour.FatherName = FatherName.ToUpper() == "NULL" ? "" : FatherName;
                labour.CurrentAddress = CurrentAddress.ToUpper() == "NULL" ? "" : CurrentAddress;
                labour.CurrentStateID = CurrentStateID.ToUpper() == "NULL" ? 0 : Convert.ToInt32(CurrentStateID); ;
                labour.CurrentCityID = CurrentCityID.ToUpper() == "NULL" ? 0 : Convert.ToInt32(CurrentCityID); ;
                labour.CurrentPincode = CurrentPincode.ToUpper() == "NULL" ? 0 : Convert.ToInt32(CurrentPincode);
                labour.PermanentAddress = PermanentAddress.ToUpper() == "NULL" ? "" : PermanentAddress;
                labour.PermanentStateID = PermanentStateID.ToUpper() == "NULL" ? 0 : Convert.ToInt32(PermanentStateID);
                labour.PermanentCityID = PermanentCityID.ToUpper() == "NULL" ? 0 : Convert.ToInt32(PermanentCityID); ;
                labour.PermanentPincode = PermanentPincode.ToUpper() == "NULL" ? 0 : Convert.ToInt32(PermanentPincode);
                labour.PhoneNo = PhoneNo.ToUpper() == "NULL" ? "0" : PhoneNo;
                labour.SectorType = SectorType.ToUpper() == "NULL" ? "0" : SectorType;
                labour.LabourType = LabourType.ToUpper() == "NULL" ? "0" : LabourType;
                labour.Specialization = Specialization.ToUpper() == "NULL" ? "0" : Specialization;
                labour.Experience = Experience.ToUpper() == "NULL" ? 0 : Convert.ToInt32(Experience);
                labour.Wages = Wages.ToUpper() == "NULL" ? 0 : Convert.ToInt32(Wages);
                labour.Lbr_Skill = Lbr_Skill.ToUpper() == "NULL" ? "" : Lbr_Skill;
                labour.Verification = Bool_Verification.ToUpper() == "NULL" ? false : true;
                labour.SupplierID = SupplierID.ToUpper() == "NULL" ? 0 : Convert.ToInt32(SupplierID);
                labour.Belonging1 = Belonging1.ToUpper() == "NULL" ? "0" : Belonging1;
                labour.Belonging2 = Belonging2.ToUpper() == "NULL" ? "0" : Belonging2;
                labour.Belonging3 = Belonging3.ToUpper() == "NULL" ? "0" : Belonging3;
                labour.Belonging4 = Belonging4.ToUpper() == "NULL" ? "0" : Belonging4;

                labour.Image_URL = webHeaderCollection["Image_URL"] == null ? "" : webHeaderCollection["Image_URL"].ToString();
                labour.Doc1_URL = webHeaderCollection["Doc1_URL"] == null ? "" : webHeaderCollection["Doc1_URL"].ToString();
                labour.Doc2_URL = webHeaderCollection["Doc2_URL"] == null ? "" : webHeaderCollection["Doc2_URL"].ToString();
                labour.Doc3_URL = webHeaderCollection["Doc3_URL"] == null ? "" : webHeaderCollection["Doc3_URL"].ToString();
                labour.Doc4_URL = webHeaderCollection["Doc4_URL"] == null ? "" : webHeaderCollection["Doc4_URL"].ToString();

                supplierDAL.InsertNewLabourData("INSERT", labour);
                labourDetails.Message = "Labour inserted successfully !";
                labourDetails.Status = true;
                return labourDetails;
            }
            catch (Exception exception)
            {
                Logger Err = new Logger();
                Err.ErrorLog(HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["ErrorLogPath"]), exception.Message, exception.StackTrace);
                labourDetails.Message = "Error occured and logged please connect the Service Manager !";
                labourDetails.Status = false;
                return labourDetails;
            }
        }