public int DeleteTheData(department entityObject) { DataSet ds = new DataSet(); paramFile PF = new paramFile(ParamsPath); try { string dbCon = PF.getDatabaseConnectionString(DBConstants.MainDB); DataOperation DO = new DataOperation(dbCon); sp_manageDepartment spParams = new sp_manageDepartment(); spParams.depName = entityObject.DepartmentName; spParams.depCode = entityObject.DepartmentCode; spParams.depId = entityObject.DepartmentId; spParams.userID = entityObject.CreatedUser; spParams.action = "Delete"; spParams.operation = "D"; DO.BeginTRansaction(); ds = DO.iteratePropertyObjectsSP(spParams, "sp_manageDepartment"); DO.EndTRansaction(); } catch (Exception ex) { var st = new StackTrace(); var sf = st.GetFrame(0); string currentMethodName = sf.GetMethod().Name; currentMethodName = ex.Message.ToString().Split('|').Count() > 0 ? ex.Message.ToString().Split('|')[0] : currentMethodName; string currentControllerName = ex.Message.ToString().Split('|').Count() > 1 ? ex.Message.ToString().Split('|')[1] : this.GetType().Name; Exception customex = new Exception(currentMethodName + " | " + currentControllerName + " | " + ex.Message + " : " + ex.StackTrace); throw customex; } return(Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString())); }
public bool CheckTheDataExistance(department entityObject) { bool result = false; DataSet ds = new DataSet(); paramFile PF = new paramFile(ParamsPath); try { string dbCon = PF.getDatabaseConnectionString(DBConstants.MainDB); DataOperation DO = new DataOperation(dbCon); sp_manageDepartment spParams = new sp_manageDepartment(); spParams.depName = entityObject.DepartmentName; spParams.depCode = entityObject.DepartmentCode; spParams.depId = 0; spParams.action = "select"; spParams.operation = "S"; DO.BeginTRansaction(); ds = DO.iteratePropertyObjectsSP(spParams, "sp_manageDepartment"); if (ds != null && ds.Tables != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0) { result = true; } DO.EndTRansaction(); } catch (Exception ex) { var st = new StackTrace(); var sf = st.GetFrame(0); string currentMethodName = sf.GetMethod().Name; currentMethodName = ex.Message.ToString().Split('|').Count() > 0 ? ex.Message.ToString().Split('|')[0] : currentMethodName; string currentControllerName = ex.Message.ToString().Split('|').Count() > 1 ? ex.Message.ToString().Split('|')[1] : this.GetType().Name; Exception customex = new Exception(currentMethodName + " | " + currentControllerName + " | " + ex.Message + " : " + ex.StackTrace); throw customex; } return(result); }