예제 #1
0
        public void GetOtherFeesDescriptionFromDb()
        {
            //otherFeesCollect = new List<OtherFeesItem>();
            otherFeesCollect.Clear();

            using (var db = Connection.CreateConnection())
            {
                db.Open();

                var sql    = "dbo.spGetOtherFeesByDescription";
                var cmd    = new SqlCommand(sql, db);
                var reader = cmd.ExecuteReader();

                if (!reader.HasRows)
                {
                    return;
                }

                while (reader.Read())
                {
                    var item = new OtherFeesItem();

                    item.OtherFees_Description = reader["OtherFees_Description"].ToString();
                    if (otherFeesCollect.Count == 0)
                    {
                        otherFeesCollect.Add(item);
                    }
                    else if (otherFeesCollect.All(x => (x.OtherFees_Description != item.OtherFees_Description)))
                    {
                        otherFeesCollect.Add(item);
                    }
                }
                db.Close();
            }
        }
        public void LoadJoinOtherPaymentsFromDb(int stdId)
        {
            otherPaymentCollect = new List <OtherFeesPaymentItem>();
            otherCollect        = new List <OtherFeesItem>();
            otherPaymentCollect.Clear();
            otherCollect.Clear();

            using (var db = Connection.CreateConnection())
            {
                db.Open();

                var sql = "dbo.spJoinOtherPayments";
                var cmd = new SqlCommand(sql, db);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@StdId", stdId));
                var reader = cmd.ExecuteReader();

                if (!reader.HasRows)
                {
                    return;
                }

                while (reader.Read())
                {
                    var item  = new OtherFeesPaymentItem();
                    var item2 = new OtherFeesItem();

                    item.OtherPay_Id           = Int32.Parse(reader["OtherPay_Id"].ToString());
                    item.OtherPay_OtherFees_Id = Int32.Parse(reader["OtherPay_OtherFees_Id"].ToString());
                    item.OtherPay_Bill_Id      = Int32.Parse(reader["OtherPay_Bill_Id"].ToString());
                    item.OtherPay_Std_Id       = Int32.Parse(reader["OtherPay_Std_Id"].ToString());
                    item.OtherPay_Number       = Int32.Parse(reader["OtherPay_Number"].ToString());
                    item.OtherPay_Paid         = Decimal.Parse(reader["OtherPay_Paid"].ToString());
                    item.OtherPay_DatePaid     = reader["OtherPay_DatePaid"].ToString();
                    item.OtherPay_Deleted      = reader["OtherPay_Deleted"].ToString();

                    item2.OtherFees_Id          = Int32.Parse(reader["OtherFees_Id"].ToString());
                    item2.OtherFees_Bill_Id     = Int32.Parse(reader["OtherFees_Bill_Id"].ToString());
                    item2.OtherFees_Std_Id      = Int32.Parse(reader["OtherFees_Std_Id"].ToString());
                    item2.OtherFees_Description = reader["OtherFees_Description"].ToString();
                    item2.OtherFees_Amount      = Decimal.Parse(reader["OtherFees_Amount"].ToString());
                    item2.OtherFees_Balance     = Decimal.Parse(reader["OtherFees_Balance"].ToString());
                    item2.OtherFees_DueDate     = reader["OtherFees_DueDate"].ToString();
                    item2.OtherFees_DatePaid    = reader["OtherFees_DatePaid"].ToString();
                    item2.OtherFees_PaymentMade = Decimal.Parse(reader["OtherFees_PaymentMade"].ToString());
                    item2.OtherFees_CutOffDate  = reader["OtherFees_CutOffDate"].ToString();
                    item2.OtherFees_Status      = reader["OtherFees_Status"].ToString();
                    item2.OtherFees_IsOld       = reader["OtherFees_IsOld"].ToString();
                    item2.OtherFees_Deleted     = reader["OtherFees_Deleted"].ToString();

                    otherPaymentCollect.Add(item);
                    otherCollect.Add(item2);
                }
                db.Close();
            }
        }
예제 #3
0
        public void LoadSelectedOtherFeesWithBillIdFromDb(string selDescription, int BillId)
        {
            otherFeesCollect = new List <OtherFeesItem>();
            otherFeesCollect.Clear();

            using (var db = Connection.CreateConnection())
            {
                db.Open();

                var sql = "dbo.spGetSelectedOtherFeesDescriptionWithBillId";
                var cmd = new SqlCommand(sql, db);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@Description", selDescription));
                cmd.Parameters.Add(new SqlParameter("@BillId", BillId));
                var reader = cmd.ExecuteReader();

                if (!reader.HasRows)
                {
                    return;
                }

                while (reader.Read())
                {
                    var item = new OtherFeesItem();

                    item.OtherFees_Id          = Int32.Parse(reader["OtherFees_Id"].ToString());
                    item.OtherFees_Bill_Id     = Int32.Parse(reader["OtherFees_Bill_Id"].ToString());
                    item.OtherFees_Std_Id      = Int32.Parse(reader["OtherFees_Std_Id"].ToString());
                    item.OtherFees_Description = reader["OtherFees_Description"].ToString();
                    item.OtherFees_Amount      = Decimal.Parse(reader["OtherFees_Amount"].ToString());
                    item.OtherFees_DatePaid    = reader["OtherFees_DatePaid"].ToString();
                    item.OtherFees_Balance     = Decimal.Parse(reader["OtherFees_Balance"].ToString());
                    item.OtherFees_Status      = reader["OtherFees_Status"].ToString();
                    item.OtherFees_PaymentMade = Decimal.Parse(reader["OtherFees_PaymentMade"].ToString());
                    item.OtherFees_DueDate     = reader["OtherFees_DueDate"].ToString();
                    item.OtherFees_CutOffDate  = reader["OtherFees_CutOffDate"].ToString();
                    item.OtherFees_IsOld       = reader["OtherFees_IsOld"].ToString();
                    item.OtherFees_Deleted     = reader["OtherFees_Deleted"].ToString();

                    otherFeesCollect.Add(item);
                }
                db.Close();
            }
        }
예제 #4
0
        public void LoadOtherFeesFromDb()
        {
            otherFeesCollect = new List <OtherFeesItem>();
            otherFeesCollect.Clear();

            using (var db = Connection.CreateConnection())
            {
                db.Open();

                var sql    = "dbo.spLoadOtherFees";
                var cmd    = new SqlCommand(sql, db);
                var reader = cmd.ExecuteReader();

                if (!reader.HasRows)
                {
                    return;
                }

                while (reader.Read())
                {
                    var item = new OtherFeesItem();

                    item.OtherFees_Id          = Int32.Parse(reader["OtherFees_Id"].ToString());
                    item.OtherFees_Bill_Id     = Int32.Parse(reader["OtherFees_Bill_Id"].ToString());
                    item.OtherFees_Std_Id      = Int32.Parse(reader["OtherFees_Std_Id"].ToString());
                    item.OtherFees_Description = reader["OtherFees_Description"].ToString();
                    item.OtherFees_Amount      = Decimal.Parse(reader["OtherFees_Amount"].ToString());
                    item.OtherFees_DatePaid    = reader["OtherFees_DatePaid"].ToString();
                    item.OtherFees_Balance     = Decimal.Parse(reader["OtherFees_Balance"].ToString());
                    item.OtherFees_Status      = reader["OtherFees_Status"].ToString();
                    item.OtherFees_PaymentMade = Decimal.Parse(reader["OtherFees_PaymentMade"].ToString());
                    item.OtherFees_DueDate     = reader["OtherFees_DueDate"].ToString();
                    item.OtherFees_CutOffDate  = reader["OtherFees_CutOffDate"].ToString();
                    item.OtherFees_IsOld       = reader["OtherFees_IsOld"].ToString();
                    item.OtherFees_Deleted     = reader["OtherFees_Deleted"].ToString();

                    otherFeesCollect.Add(item);
                }
                db.Close();
            }
        }
        public void UpdateOldOther(OtherFeesItem otherItem)
        {
            using (var db = Connection.CreateConnection())
            {
                db.Open();

                var sql = "dbo.spUpdateOldOther";
                var cmd = new SqlCommand(sql, db);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@Description", otherItem.OtherFees_Description));
                cmd.Parameters.Add(new SqlParameter("@Amount", otherItem.OtherFees_Amount));
                cmd.Parameters.Add(new SqlParameter("@Balance", otherItem.OtherFees_Balance));
                cmd.Parameters.Add(new SqlParameter("@Paymade", otherItem.OtherFees_PaymentMade));
                cmd.Parameters.Add(new SqlParameter("@DatePaid", otherItem.OtherFees_DatePaid));
                cmd.Parameters.Add(new SqlParameter("@Status", otherItem.OtherFees_Status));
                cmd.Parameters.Add(new SqlParameter("@OtherId", otherItem.OtherFees_Id));

                cmd.ExecuteNonQuery();

                db.Close();
            }
        }
예제 #6
0
        public void GetOtherFeesDescriptionWithBillIdFromDb(int billId)
        {
            //otherFeesCollect = new List<OtherFeesItem>();
            otherFeesCollect.Clear();

            using (var db = Connection.CreateConnection())
            {
                db.Open();

                var sql = "dbo.spGetOtherFeesByDescriptionWithBillId";
                var cmd = new SqlCommand(sql, db);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@BillId", billId));
                var reader = cmd.ExecuteReader();

                if (!reader.HasRows)
                {
                    return;
                }

                while (reader.Read())
                {
                    var item = new OtherFeesItem();

                    item.OtherFees_Description = reader["OtherFees_Description"].ToString();
                    if (otherFeesCollect.Count == 0)
                    {
                        otherFeesCollect.Add(item);
                    }
                    else if (otherFeesCollect.All(x => (x.OtherFees_Description != item.OtherFees_Description)))
                    {
                        otherFeesCollect.Add(item);
                    }
                }
                db.Close();
            }
        }