public object EmpSearch(Emp_Inputs Emp) { dynamic TBEmpListResult; List <object> EMPListResult = new List <object>(); try { List <Emp_Inputs> Result = InterviewTest.EmpSearch(Emp); //for (int i = 0; i < Result.Count; i++) //{ // EMPListResult.Add(new { EMPResult = Result[i] }); //} if (Result != null) { TBEmpListResult = new { status = "0", message = "success", Result }; } else { TBEmpListResult = new { status = "0", message = "Record not found" }; } } catch { TBEmpListResult = new { status = "1", message = "failed" }; } return(new { TBEmpListResult }); }
public object EmpDelete(Emp_Inputs Emp) { dynamic EmpDeleteResult; int flag = 0; try { flag = InterviewTest.EmpDelete(Emp); if (flag > 0) { EmpDeleteResult = new { status = "0", message = "success" }; } else { EmpDeleteResult = new { status = "1", message = "failed" }; } } catch { EmpDeleteResult = new { status = "1", message = "failed" }; } return(new { EmpDeleteResult }); }
public static int EmpDelete(Emp_Inputs Emp) { try { int result = 0; MySqlParameter[] ParameterList = new MySqlParameter[1]; ParameterList[0] = new MySqlParameter("?p_FK_EmpID", Emp.FK_EmpID); result = MySqlHelper.ExecuteNonQuery(GlobalVar.strAppConn, CommandType.StoredProcedure, "V7_EmpDelete", ParameterList); return(Convert.ToInt32(result)); } catch (Exception ex) { throw ex; } }
public static List <Emp_Inputs> EmpSearch(Emp_Inputs Emp) { try { MySqlParameter[] ParameterList = new MySqlParameter[2]; ParameterList[0] = new MySqlParameter("?p_FK_EmpID", Emp.FK_EmpID); ParameterList[1] = new MySqlParameter("?p_Emp_txtSearch", Emp.Emp_txtSearch); using (TouchBaseWebAPI.Data.row_productionEntities context = new TouchBaseWebAPI.Data.row_productionEntities()) { context.Connection.Open(); var Result = context.ExecuteStoreQuery <Emp_Inputs>("CALL V7_EmpSearch(?p_FK_EmpID,?p_Emp_txtSearch)", ParameterList).ToList(); return(Result); } } catch (Exception ex) { throw ex; } }
//private static TouchBaseWebAPI.Data.row_productionEntities _DBTouchbase = new TouchBaseWebAPI.Data.row_productionEntities(); public static int EmpAddEdit(Emp_Inputs Emp) { try { int result = 0; MySqlParameter[] ParameterList = new MySqlParameter[5]; ParameterList[0] = new MySqlParameter("?p_FK_EmpID", Emp.FK_EmpID); ParameterList[1] = new MySqlParameter("?p_EmpName", Emp.EmpName); ParameterList[2] = new MySqlParameter("?p_EmpCode", Emp.EmpCode); ParameterList[3] = new MySqlParameter("?p_EmpDesignation", Emp.EmpDesignation); ParameterList[4] = new MySqlParameter("?EMPID", DbType.Int32); ParameterList[4].Direction = ParameterDirection.InputOutput; result = MySqlHelper.ExecuteNonQuery(GlobalVar.strAppConn, CommandType.StoredProcedure, "V7_EmpAddEdit", ParameterList); result = Convert.ToInt32(ParameterList[4].Value); return(Convert.ToInt32(result)); } catch (Exception ex) { throw ex; } }