public async Task <HttpResponseMessage> Post([FromBody] EmployeeModel mEmployeeModel) { var formatter = RequestFormat.JsonFormaterString(); string msg = ""; try { if (string.IsNullOrEmpty(mEmployeeModel.EmCode)) { return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { Output = "error", Msg = "Employee Code is Empty" }, formatter)); } if (string.IsNullOrEmpty(mEmployeeModel.EmName)) { return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { Output = "error", Msg = "Employee Name is Empty" }, formatter)); } else { if (_gtEmployeeGetway.FncSeekRecordNew("tbl_EMPLOYEE_HR", "Id=" + mEmployeeModel.EmId + "")) { //msg = await _gtEmployeeGetway.Update(mEmployeeModel); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { Output = "success", Msg = msg }, formatter)); } else { if (_gtEmployeeGetway.FncSeekRecordNew("tbl_EMPLOYEE_HR", "Code='" + mEmployeeModel.EmCode + "'")) { return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { Output = "error", Msg = "Employee code already exists" }, formatter)); } // msg = await _gtEmployeeGetway.Save(mEmployeeModel); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { Output = "success", Msg = msg }, formatter)); } } } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { Output = "error", Msg = ex.ToString() }, formatter)); } }
//readonly SalaryCreateModel _gSalaryCreateModel = new SalaryCreateModel(); public async Task <HttpResponseMessage> Post([FromBody] EmployeeModel mEmployeeModel) { var formatter = RequestFormat.JsonFormaterString(); string msg = ""; try { bool m, y; m = _gtEmployeeGetway.FncSeekRecordNew("tbl_HR_GLO_PAYREGISTER", "MonthId=" + mEmployeeModel.MonthId + ""); y = _gtEmployeeGetway.FncSeekRecordNew("tbl_HR_GLO_PAYREGISTER", "Year=" + mEmployeeModel.AttYear + ""); if (m == true && y == true) { return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { Output = "error", Msg = "This month of this year salary are already created!!" }, formatter)); } if (mEmployeeModel.MonthId == 0) { return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { Output = "error", Msg = "Month is Empty" }, formatter)); } if (mEmployeeModel.AttYear == 0) { return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { Output = "error", Msg = "Years is Empty" }, formatter)); } else { msg = await _gtSalaryCreateGetway.Save(mEmployeeModel); return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { Output = "success", Msg = msg }, formatter)); } } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { Output = "error", Msg = ex.ToString() }, formatter)); } }
public HttpResponseMessage GetEmployeeDetalsList(int EmpId, int Month, int Year) { var formatter = RequestFormat.JsonFormaterString(); if (EmpId == 0 || Month == 0 || Year == 0) { return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { Output = "error", Msg = "please Selete Employee Code,Month and Year!!!" }, formatter)); } if (_gtEmployeeGetway.FncSeekRecordNew("tbl_HR_GLO_PAYREGISTER", "EmpId=" + EmpId + " AND MonthId=" + Month + " AND Year=" + Year + "") == false) { return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation { Output = "error", Msg = "This Employee Salary Are Not Create" }, formatter)); } else { return(Request.CreateResponse(HttpStatusCode.OK, _gtPayRegisterGlobalGateway.GetEmployeelDetalsList(EmpId, Month, Year), formatter)); } }