Beispiel #1
0
        private void Init()
        {
            ACMSDAL.TblLocker sqlLocker = new ACMSDAL.TblLocker();
            DataTable         table     = sqlLocker.GetOccupiedLocker(myPOS.StrBranchCode, myPOS.StrMembershipID);

            if (table == null || table.Rows.Count == 0)
            {
                MessageBox.Show(this, "No lockers have been rented");
                gridControl1.DataSource = null;
                return;
            }

            if (table.Rows.Count > 0)
            {
                DataColumn colStatus = new DataColumn("Status", typeof(string));
                table.Columns.Add(colStatus);

                // Only show those no yet pass grace period
                ACMSDAL.TblBranch sqlBranch = new ACMSDAL.TblBranch();

                sqlBranch.StrBranchCode = myPOS.StrBranchCode;

                sqlBranch.SelectOne();

                int gracePeriod = ACMS.Convert.ToInt32(sqlBranch.NLockerGracePeriod);

                foreach (DataRow lockerRow in table.Rows)
                {
                    DateTime dtExpiryDate = ACMS.Convert.ToDateTime(lockerRow["dtExpiry"]);

                    TimeSpan span = DateTime.Today.Subtract(dtExpiryDate.Date);

                    if (span.Days > gracePeriod)
                    {
                        lockerRow["Status"] = "Exceed Grace Period";
                    }
                    else
                    {
                        lockerRow["Status"] = "Allow to return.";
                    }
                }

                foreach (DataRow detailRow in myPOS.ReceiptItemsTable.Rows)
                {
                    string nLockerNoThatReturnCurrently = detailRow["strCode"].ToString();

                    DataRow[] rowsToDelete = table.Select("nLockerNo = " + nLockerNoThatReturnCurrently);

                    foreach (DataRow rowToDelete in rowsToDelete)
                    {
                        rowToDelete.Delete();
                    }
                }

                gridControl1.DataSource = table;
            }
        }
Beispiel #2
0
        private void simpleButtonOK_Click(object sender, System.EventArgs e)
        {
            DataRow r = gridView1.GetDataRow(gridView1.FocusedRowHandle);

            if (r != null)
            {
                string            strCode   = r["nLockerNo"].ToString();
                ACMSDAL.TblBranch sqlBranch = new ACMSDAL.TblBranch();
                sqlBranch.StrBranchCode = myPOS.StrBranchCode;
                sqlBranch.SelectOne();

                decimal rate1     = ACMS.Convert.ToDecimal(sqlBranch.MLockerRentalRate1);
                decimal rate2     = ACMS.Convert.ToDecimal(sqlBranch.MLockerRentalRate2);
                decimal finalRate = rate1;

                int monthtoRent = (int)calcEdit1.Value;

                if (monthtoRent <= 0)
                {
                    MessageBox.Show(this, "Invalid Number of Month(s)");
                    this.DialogResult = DialogResult.None;
                    return;
                }

                if (monthtoRent >= 3)
                {
                    finalRate = rate2;
                }

                myPOS.NewReceiptEntry(strCode, -1,
                                      string.Format("New Locker Rented, Locker ID : {0}", strCode),
                                      monthtoRent, finalRate, strCode);

                decimal lockerDeposit = ACMS.Convert.ToDecimal(sqlBranch.MLockerDepositRate);

                myPOS.NewReceiptEntry(strCode, -1,
                                      "Locker Deposit",
                                      1, lockerDeposit, strCode);
            }

            if (myPOS.ReceiptItemsTable.Rows.Count == 0)
            {
                myPOS.POSLockerAction = ACMSLogic.POS.LockerAction.None;
            }
        }
Beispiel #3
0
        private void simpleButtonOK_Click(object sender, System.EventArgs e)
        {
            DataRow r = gridView1.GetDataRow(gridView1.FocusedRowHandle);

            if (r != null)
            {
                string strCode = r["nLockerNo"].ToString();
                ACMSDAL.TblBranch sqlBranch = new ACMSDAL.TblBranch();
                sqlBranch.StrBranchCode = myPOS.StrBranchCode;
                sqlBranch.SelectOne();

                decimal rate1 = ACMS.Convert.ToDecimal(sqlBranch.MLockerRentalRate1);
                decimal rate2 = ACMS.Convert.ToDecimal(sqlBranch.MLockerRentalRate2);
                decimal finalRate = rate1;

                int monthtoRent = (int)calcEdit1.Value;

                if (monthtoRent <= 0)
                {
                    MessageBox.Show(this, "Invalid Number of Month(s)");
                    this.DialogResult = DialogResult.None;
                    return;
                }

                if (monthtoRent >= 3)
                {
                    finalRate = rate2;
                }

                myPOS.NewReceiptEntry(strCode, -1,
                    string.Format("Extend Locker, Extended Locker ID : {0}", strCode),
                    monthtoRent, finalRate, strCode);

            }

            if (myPOS.ReceiptItemsTable.Rows.Count == 0) myPOS.POSLockerAction = ACMSLogic.POS.LockerAction.None;
        }
Beispiel #4
0
 public override void Refresh()
 {
     ACMSDAL.TblBranch branch = new ACMSDAL.TblBranch();
     myDataTable = branch.SelectAllForLookupEdit();
     Init();
 }