Exemplo n.º 1
0
        public static int ExecuteTransactionReturnIdentity(string spName, SqlCommand cmd, SqlParameter[] paramtr)
        {
            int intCount = 0;
            int identity = 0;

            cmd.CommandText = spName;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Clear();

            for (int i = 0; i <= paramtr.Length - 1; i++)
            {
                cmd.Parameters.Add(paramtr[i]);
            }
            //For returning Value
            SqlParameter returnValue = default(SqlParameter);

            returnValue           = cmd.Parameters.Add("@num", System.Data.SqlDbType.Real);
            returnValue.Direction = System.Data.ParameterDirection.ReturnValue;

            try
            {
                cmd.ExecuteNonQuery();
                identity = Convert.ToInt32(cmd.Parameters["@num"].Value);
            }
            catch (Exception ex)
            {
                DALUtility.ErrorLog(ex.Message, "DALCommon.vb, ExecuteTransaction");
            }

            return(identity);
        }
Exemplo n.º 2
0
        public static List <SelectListItem> GetClassSectionDropdown(decimal SchoolAccountId)
        {
            List <SelectListItem> lstClassSection = new List <SelectListItem>();

            try
            {
                lstClassSection.Add(new SelectListItem {
                    Text = "--- Select Class Section--- ", Value = "0"
                });

                DataTable      tblClassList = new DataTable();
                SqlParameter[] param        = new SqlParameter[1];

                param[0] = new SqlParameter("@SchoolAccountId", SchoolAccountId);

                tblClassList = DALCommon.GetDataUsingDataTable("[sp_Admin_GetClassSectionDropdownListBySchoolId]", param);
                if (tblClassList.Rows.Count > 0)
                {
                    foreach (DataRow aClass in tblClassList.Rows)
                    {
                        lstClassSection.Add(new SelectListItem {
                            Text = Convert.ToString(aClass["SectionName"]), Value = Convert.ToString(aClass["SectionId"])
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                DALUtility.ErrorLog(ex.Message, "GetClassSectionDropdown, DALCommonFormData");
            }
            return(lstClassSection);
        }
Exemplo n.º 3
0
        //Get Report List Dropdown
        public static List <SelectListItem> GetReportListDropdown(double SchoolAccountId, int ReportCategory)
        {
            List <SelectListItem> lstReports = new List <SelectListItem>();

            try
            {
                lstReports.Add(new SelectListItem {
                    Text = "--- Select Report Type --- ", Value = "0"
                });

                DataTable      tblReportsList = new DataTable();
                SqlParameter[] param          = new SqlParameter[2];

                param[0] = new SqlParameter("@SchoolAccountId", SchoolAccountId);
                param[1] = new SqlParameter("@ReportCategory", ReportCategory);

                tblReportsList = DALCommon.GetDataUsingDataTable("[sp_GetReportInfoBySchoolId]", param);
                if (tblReportsList.Rows.Count > 0)
                {
                    foreach (DataRow aClass in tblReportsList.Rows)
                    {
                        lstReports.Add(new SelectListItem {
                            Text = Convert.ToString(aClass["ReportName"]), Value = Convert.ToString(aClass["ReportId"])
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                DALUtility.ErrorLog(ex.Message, "GetReportListDropdown, DALCommonFormData");
            }
            return(lstReports);
        }
Exemplo n.º 4
0
        //Get Repor Info Data Table
        public static ModelReportInfo GetReportInfoModel(int ReportId)
        {
            ModelReportInfo objModelReportInfo = new ModelReportInfo();

            try
            {
                DataTable      tblReportsList = new DataTable();
                SqlParameter[] param          = new SqlParameter[1];

                param[0] = new SqlParameter("@ReportId", ReportId);

                tblReportsList = DALCommon.GetDataUsingDataTable("[sp_Admin_GetReportInfoByReportId]", param);
                if (tblReportsList.Rows.Count > 0)
                {
                    objModelReportInfo.ReportFilePathName     = Convert.ToString(tblReportsList.Rows[0]["ReportFilePathName"]);
                    objModelReportInfo.SchoolAddressForReport = Convert.ToString(tblReportsList.Rows[0]["SchoolAddressForReport"]);
                    objModelReportInfo.SchoolTitleForReport   = Convert.ToString(tblReportsList.Rows[0]["SchoolTitleForReport"]);
                }
            }
            catch (Exception ex)
            {
                DALUtility.ErrorLog(ex.Message, "GetReportListDropdown, DALCommonFormData");
            }
            return(objModelReportInfo);
        }
Exemplo n.º 5
0
        public static DataTable GetDataByQuery(string Query, SqlParameter[] paramtr)
        {
            DataTable     dt  = new DataTable();
            SqlConnection cn  = new SqlConnection(ConnectionString());
            SqlCommand    cmd = new SqlCommand();

            cmd.Connection  = cn;
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = Query;
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            for (int i = 0; i <= paramtr.Length - 1; i++)
            {
                cmd.Parameters.Add(paramtr[i]);
            }

            try
            {
                da.Fill(dt);
            }
            catch (Exception ex)
            {
                DALUtility.ErrorLog(ex.Message, "DALCommon.vb, GetDataUsingDataTableByQuery");
            }

            return(dt);
        }
Exemplo n.º 6
0
        public static decimal GetIDByStoredProcedure(string spName, SqlParameter[] paramtr)
        {
            SqlDataReader dr  = null;
            SqlConnection cn  = new SqlConnection(ConnectionString());
            SqlCommand    cmd = new SqlCommand();
            decimal       j   = 0;

            cmd.Connection  = cn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = spName;

            for (int i = 0; i <= paramtr.Length - 1; i++)
            {
                cmd.Parameters.Add(paramtr[i]);
            }

            try
            {
                if ((cn.State == ConnectionState.Closed))
                {
                    cn.Open();
                }

                dr = cmd.ExecuteReader();

                if ((dr.HasRows))
                {
                    while (dr.Read())
                    {
                        j = Convert.ToDecimal(dr.GetValue(0));
                    }
                }
                else
                {
                    j = 0;
                }
            }
            catch (Exception ex)
            {
                DALUtility.ErrorLog(ex.Message, "DALCommon.vb, DataExistDblByStoredProcedure");
            }
            finally
            {
                if ((cn.State == ConnectionState.Open))
                {
                    cn.Close();
                }
                dr  = null;
                cmd = null;
            }

            return(j);
        }
Exemplo n.º 7
0
        public static bool DataExistsByStoredProcedure(string spName, SqlParameter[] paramtr)
        {
            SqlDataReader dr  = null;
            SqlConnection cn  = new SqlConnection(ConnectionString());
            SqlCommand    cmd = new SqlCommand();

            cmd.Connection  = cn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = spName;

            for (int i = 0; i <= paramtr.Length - 1; i++)
            {
                cmd.Parameters.Add(paramtr[i]);
            }

            try
            {
                if ((cn.State == ConnectionState.Closed))
                {
                    cn.Open();
                }

                dr = cmd.ExecuteReader();
            }
            catch (Exception ex)
            {
                DALUtility.ErrorLog(ex.Message, "DALCommon.vb, DataExistsByStoredProcedure");
            }

            if ((dr.HasRows))
            {
                dr  = null;
                cmd = null;
                if ((cn.State == ConnectionState.Open))
                {
                    cn.Close();
                }

                return(true);
            }
            else
            {
                dr  = null;
                cmd = null;
                if ((cn.State == ConnectionState.Open))
                {
                    cn.Close();
                }

                return(false);
            }
        }
Exemplo n.º 8
0
        public static int GetCountByProcedure(string spName, SqlParameter[] paramtr)
        {
            SqlDataReader dr     = null;
            SqlConnection cn     = new SqlConnection(ConnectionString());
            SqlCommand    cmd    = new SqlCommand();
            int           result = 0;

            cmd.Connection  = cn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = spName;

            for (int i = 0; i <= paramtr.Length - 1; i++)
            {
                cmd.Parameters.Add(paramtr[i]);
            }

            try
            {
                if ((cn.State == ConnectionState.Closed))
                {
                    cn.Open();
                }

                dr = cmd.ExecuteReader();

                if ((dr.HasRows))
                {
                    while (dr.Read())
                    {
                        result = Convert.ToInt32(dr.GetValue(0));
                    }
                }
            }
            catch (Exception ex)
            {
                DALUtility.ErrorLog(ex.Message, "DALCommon.vb, GetCountByProcedure");
            }
            finally
            {
                cmd = null;
                dr  = null;
                if ((cn.State == ConnectionState.Open))
                {
                    cn.Close();
                }
            }

            return(result);
        }
Exemplo n.º 9
0
        public static decimal ExecuteNonQueryReturnIdentity(string spName, SqlParameter[] paramtr)
        {
            decimal       identity = 0;
            SqlConnection cn       = new SqlConnection(ConnectionString());
            SqlCommand    cmd      = new SqlCommand();

            cmd.Connection  = cn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = spName;
            for (int i = 0; i <= paramtr.Length - 1; i++)
            {
                cmd.Parameters.Add(paramtr[i]);
            }

            //For returning Value
            SqlParameter returnValue = default(SqlParameter);

            returnValue           = cmd.Parameters.Add("@num", System.Data.SqlDbType.Real);
            returnValue.Direction = System.Data.ParameterDirection.ReturnValue;

            try
            {
                if ((cn.State == ConnectionState.Closed))
                {
                    cn.Open();
                }

                cmd.ExecuteNonQuery();

                identity = Convert.ToDecimal(cmd.Parameters["@num"].Value);
            }
            catch (Exception ex)
            {
                DALUtility.ErrorLog(ex.Message, "DALCommon.vb, ExecuteNonQueryReturnIdentity");
            }
            finally
            {
                cmd = null;
                if ((cn.State == ConnectionState.Open))
                {
                    cn.Close();
                }
            }
            return(identity);
        }
Exemplo n.º 10
0
        //Get Repor Info Data Table
        public static DataTable GetReportInfoDataTable(int ReportId)
        {
            DataTable tblDataTable = new DataTable();

            try
            {
                DataTable      tblReportsList = new DataTable();
                SqlParameter[] param          = new SqlParameter[1];

                param[0] = new SqlParameter("@ReportId", ReportId);

                tblReportsList = DALCommon.GetDataUsingDataTable("[sp_Admin_GetReportInfoByReportId]", param);
                return(tblDataTable);
            }
            catch (Exception ex)
            {
                DALUtility.ErrorLog(ex.Message, "GetReportListDropdown, DALCommonFormData");
            }

            return(tblDataTable);
        }
Exemplo n.º 11
0
        public static DataTable GetDataByStoredProcedure(string spName)
        {
            DataTable     dt  = new DataTable();
            SqlConnection cn  = new SqlConnection(ConnectionString());
            SqlCommand    cmd = new SqlCommand();

            cmd.Connection  = cn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = spName;
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            try
            {
                da.Fill(dt);
            }
            catch (Exception ex)
            {
                DALUtility.ErrorLog(ex.Message, "DALCommon.vb, GetDataUsingDataTable");
            }

            return(dt);
        }
Exemplo n.º 12
0
        public static DataTable GetDataByQuery(string Query)
        {
            DataTable     dt  = new DataTable();
            SqlConnection cn  = new SqlConnection(ConnectionString());
            SqlCommand    cmd = new SqlCommand();

            cmd.Connection  = cn;
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = Query;
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            try
            {
                da.Fill(dt);
            }
            catch (Exception ex)
            {
                DALUtility.ErrorLog(ex.Message, "DALCommon.vb, GetDataUsingDataTableByQuery");
            }

            return(dt);
        }
Exemplo n.º 13
0
        public static int ExecuteNonQuery(string spName, SqlParameter[] paramtr)
        {
            int           recCount = 0;
            SqlConnection cn       = new SqlConnection(ConnectionString());
            SqlCommand    cmd      = new SqlCommand();

            cmd.Connection  = cn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = spName;
            for (int i = 0; i <= paramtr.Length - 1; i++)
            {
                cmd.Parameters.Add(paramtr[i]);
            }

            try
            {
                if ((cn.State == ConnectionState.Closed))
                {
                    cn.Open();
                }

                recCount = cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                DALUtility.ErrorLog(ex.Message, "DALCommon.vb, ExecuteNonQuery");
            }
            finally
            {
                cmd = null;
                if ((cn.State == ConnectionState.Open))
                {
                    cn.Close();
                }
            }

            return(recCount);
        }
Exemplo n.º 14
0
        public static int ExecuteTransaction(string spName, SqlCommand cmd, SqlParameter[] paramtr)
        {
            int intCount = 0;

            cmd.CommandText = spName;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Clear();

            for (int i = 0; i <= paramtr.Length - 1; i++)
            {
                cmd.Parameters.Add(paramtr[i]);
            }

            try
            {
                intCount = cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                DALUtility.ErrorLog(ex.Message, "DALCommon.vb, ExecuteTransaction");
            }

            return(intCount);
        }
Exemplo n.º 15
0
        //Get Repor Info Data Table
        public static string GetReportFileNamePath(int ReportId)
        {
            string reportFileName = "";

            try
            {
                DataTable      tblReportsList = new DataTable();
                SqlParameter[] param          = new SqlParameter[1];

                param[0] = new SqlParameter("@ReportId", ReportId);

                tblReportsList = DALCommon.GetDataUsingDataTable("[sp_Admin_GetReportInfoByReportId]", param);
                if (tblReportsList.Rows.Count > 0)
                {
                    reportFileName = Convert.ToString(tblReportsList.Rows[0]["ReportFilePathName"]);
                }
            }
            catch (Exception ex)
            {
                DALUtility.ErrorLog(ex.Message, "GetReportListDropdown, DALCommonFormData");
            }

            return(reportFileName);
        }
Exemplo n.º 16
0
        public static int SendEmail(string ToEmail, string fromEmail, string Subject, string Body, string SMTP, string Username, string Password)
        {
            try
            {
                System.Net.Mail.MailMessage  mailMessage = new System.Net.Mail.MailMessage(new MailAddress(fromEmail), new MailAddress(ToEmail));
                System.Net.NetworkCredential SmtpUser    = new System.Net.NetworkCredential(Username, Password);
                StringBuilder emailHeader = new StringBuilder();
                StringBuilder emailFooter = new StringBuilder();

                //message body and subject property
                mailMessage.Subject    = Subject;
                mailMessage.Body       = emailHeader.ToString() + Body + emailFooter.ToString();
                mailMessage.IsBodyHtml = true;

                //create smtp client
                SmtpClient smtpMail = new SmtpClient();

                //assign smtp properties
                smtpMail.Host                  = SMTP;
                smtpMail.Port                  = 587;
                smtpMail.EnableSsl             = true;
                smtpMail.DeliveryMethod        = SmtpDeliveryMethod.Network;
                smtpMail.UseDefaultCredentials = false;
                smtpMail.Credentials           = SmtpUser;

                //send mail
                smtpMail.Send(mailMessage);

                return(1);
            }
            catch (Exception ex)
            {
                DALUtility.ErrorLog(ex.Message + "SendEmail");
                return(0);
            }
        }
Exemplo n.º 17
0
        public int InsertStudentMonthlyFeeInsertTransaction(DataTable studentList, ModelStudentFee objModelStudentFee, int FeeMonth, decimal AddedBy)
        {
            //Initialization
            conn        = new SqlConnection(ConnectionString());
            strErrorMsg = string.Empty;
            intStatus   = 0;
            int totalStudent       = studentList.Rows.Count;
            int updatedTotalRecord = 0;

            try
            {
                //Open Connection
                if ((conn.State == System.Data.ConnectionState.Closed))
                {
                    conn.Open();
                }

                //Begin Transaction
                sqlTrans = conn.BeginTransaction();

                //Initialize Command
                cmd             = new SqlCommand();
                cmd.Connection  = conn;
                cmd.Transaction = sqlTrans;

                //Update Transaction Response
                foreach (DataRow aStudent in studentList.Rows)
                {
                    SqlParameter[] paramStudentFee = new SqlParameter[12];

                    paramStudentFee[0]  = new SqlParameter("@StudentId", aStudent["StudentId"]);
                    paramStudentFee[1]  = new SqlParameter("@ComputerCode", aStudent["ComputerCode"]);
                    paramStudentFee[2]  = new SqlParameter("@FeeMonth", FeeMonth);
                    paramStudentFee[3]  = new SqlParameter("@MonthlyFee", aStudent["MonthlyFee"]);
                    paramStudentFee[4]  = new SqlParameter("@AdmissionFee", objModelStudentFee.AdmissionFee);
                    paramStudentFee[5]  = new SqlParameter("@Admission", objModelStudentFee.Admission);
                    paramStudentFee[6]  = new SqlParameter("@ReAdmissionFee", objModelStudentFee.ReAdmissionFee);
                    paramStudentFee[7]  = new SqlParameter("@RegistrationFee", objModelStudentFee.RegistrationFee);
                    paramStudentFee[8]  = new SqlParameter("@ComputerFee", objModelStudentFee.ComputerFee);
                    paramStudentFee[9]  = new SqlParameter("@Fine", objModelStudentFee.Fine);
                    paramStudentFee[10] = new SqlParameter("@ExamFee", objModelStudentFee.ExamFee);
                    paramStudentFee[11] = new SqlParameter("@GeneratorFee", objModelStudentFee.GeneratorFee);

                    intStatus = DALCommon.ExecuteTransaction("[sp_Admin_InsertStudentMonthlyFeeBulkStudentId]", cmd, paramStudentFee);
                    if (intStatus >= 1)
                    {
                        updatedTotalRecord = updatedTotalRecord + 1;
                    }
                    else
                    {
                        DALUtility.ErrorLogBulkFeeInsertion(aStudent["StudentId"].ToString(), aStudent["MonthlyFee"].ToString(), "Bulk Fee noy Insert", AddedBy.ToString());
                    }
                }
                if (totalStudent == updatedTotalRecord)
                {
                    //Commit Transaction
                    sqlTrans.Commit();
                    intStatus = 1;
                }
                else if (intStatus == -1)
                {
                    strErrorMsg = "Error Occured while inserting record";
                }
                else if (intStatus == -2)
                {
                    strErrorMsg = "Fee already exists for this month";
                }

                else if (intStatus == -3)
                {
                    strErrorMsg = "Error occured while generation Serial Number index";
                }

                else if (intStatus == -4)
                {
                    strErrorMsg = "Student stucked off";
                }
                //If Error Field Is Not Empty
                if ((!string.IsNullOrEmpty(strErrorMsg)))
                {
                    DALUtility.ErrorLog(strErrorMsg, "BulkFeeInsertionTransaction.cs, InsertStudentMonthlyFeeInsertTransaction");
                }
            }
            catch (Exception ex)
            {
                sqlTrans.Rollback();
                DALUtility.ErrorLog(ex.Message, "BulkFeeInsertionTransaction.cs, InsertStudentMonthlyFeeInsertTransaction");
            }
            finally
            {
                if ((conn.State == System.Data.ConnectionState.Open))
                {
                    conn.Close();
                }
                cmd      = null;
                sqlTrans = null;
            }

            return(intStatus);
        }
Exemplo n.º 18
0
        public int InsertFeeVoucherFeePaidTransaction(string VoucherPaidDate, double FeeVoucherId, DataTable FeeIdList, double AddedBy)
        {
            //Initialization
            conn        = new SqlConnection(ConnectionString());
            strErrorMsg = string.Empty;
            intStatus   = 0;
            int totalFeeId         = FeeIdList.Rows.Count;
            int updatedTotalRecord = 0;
            int ResultStatus       = 0;


            try
            {
                //Open Connection
                if ((conn.State == System.Data.ConnectionState.Closed))
                {
                    conn.Open();
                }

                //Begin Transaction
                sqlTrans = conn.BeginTransaction();

                //Initialize Command
                cmd             = new SqlCommand();
                cmd.Connection  = conn;
                cmd.Transaction = sqlTrans;

                //Update Transaction Response
                foreach (DataRow aFeeId in FeeIdList.Rows)
                {
                    int            ResultRecord    = 0;
                    SqlParameter[] paramStudentFee = new SqlParameter[3];
                    paramStudentFee[0] = new SqlParameter("@FeeId", aFeeId["FeeId"]);
                    paramStudentFee[1] = new SqlParameter("@FeeDate", VoucherPaidDate);
                    paramStudentFee[2] = new SqlParameter("@AddedBy", AddedBy);

                    ResultRecord = DALCommon.ExecuteTransaction("[sp_Admin_UpdateStudentFeePaidMarkedByFeeId]", cmd, paramStudentFee);

                    if (ResultRecord > 0)
                    {
                        updatedTotalRecord = updatedTotalRecord + 1;
                    }
                    else
                    {
                        intStatus   = -2;
                        strErrorMsg = "Error occured while marking fee month paid with fee Id";
                    }
                }

                if (updatedTotalRecord == totalFeeId)
                {
                    SqlParameter[] paramFeeVoucher = new SqlParameter[1];
                    paramFeeVoucher[0] = new SqlParameter("@VoucherId", FeeVoucherId);
                    //Mark voucher paid
                    ResultStatus = DALCommon.ExecuteTransaction("[sp_Admin_UpdateStudentFeeVoucherPaidMarkedByVoucherId]", cmd, paramFeeVoucher);

                    if (ResultStatus > 0)
                    {
                        sqlTrans.Commit();
                        intStatus = 1;
                    }
                }
                else
                {
                    intStatus   = -3;
                    strErrorMsg = "Error Occured while marking fee voucher paid";
                }

                //If Error Field Is Not Empty
                if ((!string.IsNullOrEmpty(strErrorMsg)))
                {
                    DALUtility.ErrorLog(strErrorMsg, "BulkFeeInsertionTransaction.cs, InsertStudentMonthlyFeeInsertTransaction, InsertFeeVoucherFeePaidTransaction");
                }
            }

            catch (Exception ex)
            {
                sqlTrans.Rollback();
                DALUtility.ErrorLog(ex.Message, "StudentFeeVoucherTransaction.cs, InsertUnPaidMonthlyFeeVoucherTransaction");
            }
            finally
            {
                if ((conn.State == System.Data.ConnectionState.Open))
                {
                    conn.Close();
                }
                cmd      = null;
                sqlTrans = null;
            }

            return(intStatus);
        }
Exemplo n.º 19
0
        public int InsertUnPaidMonthlyFeeVoucherTransaction(string VoucherDueDate, DataTable studentList, decimal AddedBy)
        {
            //Initialization
            conn        = new SqlConnection(ConnectionString());
            strErrorMsg = string.Empty;
            intStatus   = 0;
            int totalStudent       = studentList.Rows.Count;
            int updatedTotalRecord = 0;
            int ResultStatus       = 0;

            try
            {
                //Open Connection
                if ((conn.State == System.Data.ConnectionState.Closed))
                {
                    conn.Open();
                }

                //Begin Transaction
                sqlTrans = conn.BeginTransaction();

                //Initialize Command
                cmd             = new SqlCommand();
                cmd.Connection  = conn;
                cmd.Transaction = sqlTrans;

                //Update Transaction Response
                foreach (DataRow aStudent in studentList.Rows)
                {
                    double         voucherId       = 0;
                    SqlParameter[] paramStudentFee = new SqlParameter[3];
                    paramStudentFee[0] = new SqlParameter("@StudentId", aStudent["StudentId"]);
                    paramStudentFee[1] = new SqlParameter("@VoucherDueDate", VoucherDueDate);
                    paramStudentFee[2] = new SqlParameter("@AddedBy", AddedBy);

                    voucherId = DALCommon.ExecuteTransactionReturnIdentity("[sp_Admin_InsertStudentFeeVoucher]", cmd, paramStudentFee);
                    if (voucherId >= 1)
                    {
                        DataTable      tblUnPaidFeeMonth   = new DataTable();
                        SqlParameter[] paramUnPaidFeeMonth = new SqlParameter[3];
                        paramUnPaidFeeMonth[0] = new SqlParameter("@VoucherId", voucherId);
                        paramUnPaidFeeMonth[1] = new SqlParameter("@StudentId ", aStudent["StudentId"]);
                        paramUnPaidFeeMonth[2] = new SqlParameter("@AddedBy ", AddedBy);
                        //Bulk Monthly Fee Voucher Creating
                        ResultStatus = DALCommon.ExecuteTransaction("[sp_Admin_InsertFeeVoucherMonthsDataByVoucherID]", cmd, paramUnPaidFeeMonth);

                        if (ResultStatus > 0)
                        {
                            updatedTotalRecord = updatedTotalRecord + 1;
                        }
                        else
                        {
                            intStatus   = -2;
                            strErrorMsg = "Error Occured while inserting record";
                            DALUtility.ErrorLog("Error occured inserting Monthly Fee Voucher record", "StudentFeeVoucherTransaction.cs, InsertUnPaidMonthlyFeeVoucherTransaction");
                        }
                    }
                    else
                    {
                        intStatus   = -3;
                        strErrorMsg = "Error Occured while inserting record";
                        DALUtility.ErrorLog("Error occured generating VoucherId", "StudentFeeVoucherTransaction.cs, InsertUnPaidMonthlyFeeVoucherTransaction");
                    }
                }
                //If Error Field Is Not Empty
                if ((!string.IsNullOrEmpty(strErrorMsg)))
                {
                    DALUtility.ErrorLog(strErrorMsg, "BulkFeeInsertionTransaction.cs, InsertStudentMonthlyFeeInsertTransaction");
                }
                if (updatedTotalRecord == totalStudent)
                {
                    sqlTrans.Commit();
                    intStatus = 1;
                }
            }

            catch (Exception ex)
            {
                sqlTrans.Rollback();
                DALUtility.ErrorLog(ex.Message, "StudentFeeVoucherTransaction.cs, InsertUnPaidMonthlyFeeVoucherTransaction");
            }
            finally
            {
                if ((conn.State == System.Data.ConnectionState.Open))
                {
                    conn.Close();
                }
                cmd      = null;
                sqlTrans = null;
            }

            return(intStatus);
        }