public DataResultArgs <List <PaymentEntity> > Get_Payment(int studentId, string year) { DataProcess.ControlAdminAuthorization(); DataResultArgs <List <PaymentEntity> > resultSet = new DataResultArgs <List <PaymentEntity> >(); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@studentId", studentId); cmd.Parameters.AddWithValue("@year", year); using (SqlConnection con = Connection.Conn) { con.Open(); DataResultArgs <SqlDataReader> result = DataProcess.ExecuteProcDataReader(con, cmd, "get_Payment"); if (result.HasError) { resultSet.HasError = result.HasError; resultSet.ErrorDescription = result.ErrorDescription; resultSet.ErrorCode = result.ErrorCode; } else { List <PaymentEntity> lst = GetList(result); resultSet.Result = lst; } con.Close(); } return(resultSet); }
public DataResultArgs <List <PaymentEntity> > Get_PaymentForCurrentMonth() { DataProcess.ControlAdminAuthorization(); DataResultArgs <List <PaymentEntity> > resultSet = new DataResultArgs <List <PaymentEntity> >(); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; using (SqlConnection con = Connection.Conn) { con.Open(); DataResultArgs <SqlDataReader> result = DataProcess.ExecuteProcDataReader(con, cmd, "Get_PaymentForCurrentMonth"); if (result.HasError) { resultSet.HasError = result.HasError; resultSet.ErrorDescription = result.ErrorDescription; resultSet.ErrorCode = result.ErrorCode; } else { List <PaymentEntity> lst = GetList(result); resultSet.Result = lst; } con.Close(); } return(resultSet); }
private static void GetList(SqlCommand cmd, DataResultArgs <List <AdminEntity> > resultSet) { using (SqlConnection con = Connection.Conn) { con.Open(); DataResultArgs <SqlDataReader> result = DataProcess.ExecuteProcDataReader(con, cmd, "get_Admin"); if (result.HasError) { resultSet.HasError = result.HasError; resultSet.ErrorDescription = result.ErrorDescription; resultSet.ErrorCode = result.ErrorCode; } else { SqlDataReader dr = result.Result; List <AdminEntity> lst = new List <AdminEntity>(); AdminEntity elist; while (dr.Read()) { elist = new AdminEntity(); elist.Id = GeneralFunctions.GetData <Int32>(dr["id"]); elist.UserName = GeneralFunctions.GetData <String>(dr["userName"]); elist.Password = GeneralFunctions.GetData <String>(dr["password"]); elist.IsActive = GeneralFunctions.GetData <Boolean?>(dr["isActive"]); elist.LastLoginDate = GeneralFunctions.GetData <DateTime?>(dr["LastLoginDate"]); elist.AdminType = GeneralFunctions.GetData <Int16?>(dr["AdminType"]); lst.Add(elist); } dr.Close(); resultSet.Result = lst; } con.Close(); } }
public DataResultArgs <List <PaymentTypeEntity> > Get_PaymentType(SearchEntity entity) { DataProcess.ControlAdminAuthorization(); if (staticPaymentTypeList == null) { DataResultArgs <List <PaymentTypeEntity> > resultSet = new DataResultArgs <List <PaymentTypeEntity> >(); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@id", entity.Id); cmd.Parameters.AddWithValue("@isActive", entity.IsActive); cmd.Parameters.AddWithValue("@isDeleted", entity.IsDeleted); using (SqlConnection con = Connection.Conn) { con.Open(); DataResultArgs <SqlDataReader> result = DataProcess.ExecuteProcDataReader(con, cmd, "get_PaymentType"); if (result.HasError) { resultSet.HasError = result.HasError; resultSet.ErrorDescription = result.ErrorDescription; resultSet.ErrorCode = result.ErrorCode; } else { SqlDataReader dr = result.Result; List <PaymentTypeEntity> lst = new List <PaymentTypeEntity>(); PaymentTypeEntity elist; while (dr.Read()) { elist = new PaymentTypeEntity(); elist.Id = GeneralFunctions.GetData <Int32>(dr["id"]); elist.Name = GeneralFunctions.GetData <String>(dr["name"]); elist.Amount = GeneralFunctions.GetData <Decimal?>(dr["amount"]); elist.IsActive = GeneralFunctions.GetData <Boolean?>(dr["isActive"]); elist.UpdatedOn = GeneralFunctions.GetData <DateTime>(dr["updatedOn"]); lst.Add(elist); } dr.Close(); resultSet.Result = lst; } con.Close(); } staticPaymentTypeList = resultSet; } return(staticPaymentTypeList); }
public DataResultArgs <List <StudentEntity> > Get_Student(SearchEntity entity) { DataProcess.ControlAdminAuthorization(); DataResultArgs <List <StudentEntity> > resultSet = new DataResultArgs <List <StudentEntity> >(); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@id", entity.Id); cmd.Parameters.AddWithValue("@isActive", entity.IsActive); cmd.Parameters.AddWithValue("@isDeleted", entity.IsDeleted); using (SqlConnection con = Connection.Conn) { con.Open(); DataResultArgs <SqlDataReader> result = DataProcess.ExecuteProcDataReader(con, cmd, "get_Student"); if (result.HasError) { resultSet.HasError = result.HasError; resultSet.ErrorDescription = result.ErrorDescription; resultSet.ErrorCode = result.ErrorCode; } else { SqlDataReader dr = result.Result; List <StudentEntity> lst = new List <StudentEntity>(); while (dr.Read()) { var studentEntity = GetEntity(dr); lst.Add(studentEntity); } dr.Close(); resultSet.Result = lst; } con.Close(); } return(resultSet); }
public DataResultArgs <StudentEntity> Get_Student(string citizenshipNumber) { DataProcess.ControlAdminAuthorization(); DataResultArgs <StudentEntity> resultSet = new DataResultArgs <StudentEntity>(); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@citizenshipNumber", citizenshipNumber); using (SqlConnection con = Connection.Conn) { con.Open(); DataResultArgs <SqlDataReader> result = DataProcess.ExecuteProcDataReader(con, cmd, "get_Student"); if (result.HasError) { resultSet.HasError = result.HasError; resultSet.ErrorDescription = result.ErrorDescription; resultSet.ErrorCode = result.ErrorCode; } else { SqlDataReader dr = result.Result; StudentEntity elist; while (dr.Read()) { elist = GetEntity(dr); resultSet.Result = elist; } dr.Close(); } con.Close(); } return(resultSet); }