Exemplo n.º 1
0
        public HttpResponseMessage CreateManPower(ManpowerInsertDTO objManPower)
        {
            HttpResponseMessage message;

            try
            {
                // ManPowerDataAccessLayer dal = new ManPowerDataAccessLayer();
                var dynObj = new { result = _obj.InsertManPower(objManPower) };
                message = Request.CreateResponse(HttpStatusCode.OK, dynObj);
            }
            catch (Exception ex)
            {
                message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = "Somthing wrong, Try Again!" });
                ErrorLog.CreateErrorMessage(ex, "ManPower", "CreateManPower");
            }
            return(message);
        }
Exemplo n.º 2
0
        public GetManPowerId InsertManPower(ManpowerInsertDTO objManPower)
        {
            GetManPowerId objManPowerId = new GetManPowerId();

            using (DbLayer dbLayer = new DbLayer())
            {
                SqlCommand SqlCmd = new SqlCommand("spInsertManPower");
                SqlCmd.CommandType = CommandType.StoredProcedure;
                SqlCmd.Parameters.AddWithValue("@Name", objManPower.Name);
                SqlCmd.Parameters.AddWithValue("@Gender", objManPower.Gender);
                SqlCmd.Parameters.AddWithValue("@DateofBirth", objManPower.DateofBirth);
                SqlCmd.Parameters.AddWithValue("@Age", objManPower.Age);
                SqlCmd.Parameters.AddWithValue("@Mobile", ((objManPower.Mobile == null) ? "" : objManPower.Mobile));
                SqlCmd.Parameters.AddWithValue("@AlternateNumber", ((objManPower.AlternateNumber == null) ? "" : objManPower.AlternateNumber));
                SqlCmd.Parameters.AddWithValue("@MaritalStatus", objManPower.MaritalStatus);
                SqlCmd.Parameters.AddWithValue("@CurrentAddress", ((objManPower.CurrentAddress == null) ? "" : objManPower.CurrentAddress));
                SqlCmd.Parameters.AddWithValue("@PermanentAddress", ((objManPower.PermanentAddress == null) ? "" : objManPower.PermanentAddress));
                SqlCmd.Parameters.AddWithValue("@Photo", ((objManPower.Photo == null) ? "" : objManPower.Photo));
                SqlCmd.Parameters.AddWithValue("@FatherName", objManPower.FatherName);
                SqlCmd.Parameters.AddWithValue("@MotherName", objManPower.MotherName);
                SqlCmd.Parameters.AddWithValue("@State", objManPower.State);
                SqlCmd.Parameters.AddWithValue("@City", objManPower.City);
                SqlCmd.Parameters.AddWithValue("@JobType", ((objManPower.JobType == null) ? "" : objManPower.JobType));
                SqlCmd.Parameters.AddWithValue("@BloodGroup", ((objManPower.BloodGroup == null) ? "" : objManPower.BloodGroup));
                SqlCmd.Parameters.AddWithValue("@Company", objManPower.Company);
                SqlCmd.Parameters.AddWithValue("@DateofJoin", objManPower.DateofJoin);
                SqlCmd.Parameters.AddWithValue("@Designation", objManPower.Designation);
                SqlCmd.Parameters.AddWithValue("@PreviousCompany", ((objManPower.PreviousCompany == null) ? "" : objManPower.PreviousCompany));
                SqlCmd.Parameters.AddWithValue("@ReferenceBy", ((objManPower.ReferenceBy == null) ? "" : objManPower.ReferenceBy));
                SqlCmd.Parameters.AddWithValue("@ReferenceContact1", ((objManPower.ReferenceContact1 == null) ? "" : objManPower.ReferenceContact1));
                SqlCmd.Parameters.AddWithValue("@ReferenceContact2", ((objManPower.ReferenceContact2 == null) ? "" : objManPower.ReferenceContact2));
                SqlCmd.Parameters.AddWithValue("@TotalExperience", objManPower.TotalExperience);
                SqlCmd.Parameters.AddWithValue("@VerificationStatus", objManPower.VerificationStatus);
                SqlCmd.Parameters.AddWithValue("@Payment", objManPower.Payment);
                SqlCmd.Parameters.AddWithValue("@CreatedBy", objManPower.CreatedBy);

                objManPowerId = dbLayer.GetEntityList <GetManPowerId>(SqlCmd).FirstOrDefault();
            }
            return(objManPowerId);
        }
Exemplo n.º 3
0
        public HttpResponseMessage CreateManpowerDetils()
        {
            HttpResponseMessage message;

            ManpowerInsertDTO objManpower = new ManpowerInsertDTO();

            var VerifyProof = HttpContext.Current.Request.Files[0];
            var PhotoName   = DateTime.Now.Ticks + "_" + VerifyProof.FileName;

            objManpower.Name   = HttpContext.Current.Request.Form[0];
            objManpower.Gender = HttpContext.Current.Request.Form[1];
            var DateofBirth = HttpContext.Current.Request.Form[2];
            var Age         = HttpContext.Current.Request.Form[3];

            objManpower.Mobile          = HttpContext.Current.Request.Form[4];
            objManpower.AlternateNumber = HttpContext.Current.Request.Form[5];
            var MaritalStatus = HttpContext.Current.Request.Form[6];

            objManpower.CurrentAddress   = HttpContext.Current.Request.Form[7];
            objManpower.PermanentAddress = HttpContext.Current.Request.Form[8];
            objManpower.Photo            = PhotoName;
            var State = HttpContext.Current.Request.Form[9];
            var City  = HttpContext.Current.Request.Form[10];

            objManpower.JobType = HttpContext.Current.Request.Form[11];
            var Company     = HttpContext.Current.Request.Form[12];
            var DateofJoin  = HttpContext.Current.Request.Form[13];
            var Designation = HttpContext.Current.Request.Form[14];

            objManpower.ReferenceBy       = HttpContext.Current.Request.Form[15];
            objManpower.PreviousCompany   = HttpContext.Current.Request.Form[16];
            objManpower.ReferenceContact1 = HttpContext.Current.Request.Form[17];
            objManpower.ReferenceContact2 = HttpContext.Current.Request.Form[18];
            objManpower.TotalExperience   = HttpContext.Current.Request.Form[19];
            var VerificationStatus = HttpContext.Current.Request.Form[20];

            objManpower.FatherName = HttpContext.Current.Request.Form[21];
            objManpower.MotherName = HttpContext.Current.Request.Form[22];
            var Payment = HttpContext.Current.Request.Form[23];

            objManpower.CreatedBy = HttpContext.Current.Request.Form[24];

            objManpower.DateofBirth        = Convert.ToDateTime(DateofBirth);
            objManpower.Age                = Convert.ToInt16(Age);
            objManpower.MaritalStatus      = Convert.ToByte(MaritalStatus);
            objManpower.State              = Convert.ToInt32(State);
            objManpower.City               = Convert.ToInt32(City);
            objManpower.DateofJoin         = Convert.ToDateTime(DateofJoin);
            objManpower.Company            = Convert.ToInt32(Company);
            objManpower.Designation        = Convert.ToInt32(Designation);
            objManpower.VerificationStatus = Convert.ToByte(VerificationStatus);
            objManpower.Payment            = Convert.ToInt32(Payment);
            if (VerifyProof != null && PhotoName != null)
            {
                var pathf        = HttpContext.Current.Server.MapPath("~/PersonalImages");
                var fileSavePath = Path.Combine(pathf, PhotoName);

                Directory.CreateDirectory(pathf);
                VerifyProof.SaveAs(fileSavePath);
            }

            try
            {
                // ManPowerDataAccessLayer dal = new ManPowerDataAccessLayer();
                var dynObj = new { result = _obj.InsertManPower(objManpower) };
                message = Request.CreateResponse(HttpStatusCode.OK, dynObj);
            }
            catch (Exception ex)
            {
                message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = "Somthing wrong, Try Again!" });
                ErrorLog.CreateErrorMessage(ex, "ManPower", "CreateManpowerDetils");
            }

            return(message);
        }