private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            if (SystemClass.CheckConnection())
            {
                ImusCityHallEntities db       = new ImusCityHallEntities();
                FundBank             fundBank = db.FundBanks.Find(fundBankId);
                fundname.Text = string.Join("/", fundBank.AccountNumber, fundBank.Fund.FundName, fundBank.Bank.BankCode);
                List <DamageCheck> damageCheckList = new List <DamageCheck>();
                foreach (var item in db.DamageChecks.Where(m => m.FundBankID == fundBankId))
                {
                    var damageCheck = new DamageCheck()
                    {
                        DamageCheckId = item.DamageCheckId,
                        CheckNumber   = item.CheckNumber,
                        CreatedDate   = item.CreatedDate
                    };

                    damageCheckList.Add(damageCheck);
                }
                damgecheckdg.ItemsSource       = damageCheckList.OrderBy(m => m.CheckNumber);
                damgecheckdg.SelectedValuePath = "DamageCheckId";
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }
示例#2
0
 private void Awake()
 {
     if (instanceHP == null)
     {
         instanceHP = this;
     }
 }
示例#3
0
 void Start()
 {
     fires        = new List <GameObject>();
     player       = GameObject.Find("Character");
     playerScript = player.GetComponent <DamageCheck>();
     ring         = GameObject.Find("RingOfFire");
     diff         = playerScript.diff;
 }
示例#4
0
 private void savebtn_Click(object sender, RoutedEventArgs e)
 {
     if (SystemClass.CheckConnection())
     {
         ImusCityHallEntities db = new ImusCityHallEntities();
         int result;
         if (int.TryParse(checknumbertb.Text, out result))
         {
             string formatted = result.ToString("D10");
             if (db.Checks.Where(m => m.Disbursement.FundBankID == fundBankId && m.CheckNo == formatted).Count() >= 1)
             {
                 MessageBox.Show("The check number that you are trying to add with the corresponding fund is already used");
             }
             else if (db.DamageChecks.Where(m => m.FundBankID == fundBankId && m.CheckNumber == formatted).Count() >= 1)
             {
                 MessageBox.Show("The check number that you are trying to add with the corresponding fund is already in the list of damaged check");
             }
             else if (String.IsNullOrEmpty(checknumbertb.Text))
             {
                 MessageBox.Show("Please input check number");
             }
             else
             {
                 DamageCheck damageCheck = new DamageCheck();
                 damageCheck.FundBankID  = fundBankId;
                 damageCheck.CheckNumber = formatted;
                 damageCheck.CreatedDate = DateTime.Now;
                 damageCheck.CreatedBy   = App.EmployeeID;
                 db.DamageChecks.Add(damageCheck);
                 db.SaveChanges();
                 MessageBox.Show("Damage check entry added successfuly");
                 checknumbertb.Clear();
             }
         }
         else
         {
             MessageBox.Show("Please input numbers only");
         }
     }
     else
     {
         MessageBox.Show(SystemClass.DBConnectionErrorMessage);
     }
 }
        private void deletebtn_Click(object sender, RoutedEventArgs e)
        {
            if (damgecheckdg.SelectedValue == null)
            {
                MessageBox.Show("Please select an item");
            }
            else
            {
                if (SystemClass.CheckConnection())
                {
                    ImusCityHallEntities db       = new ImusCityHallEntities();
                    int         damageCheckId     = (int)damgecheckdg.SelectedValue;
                    DamageCheck damageCheckDelete = db.DamageChecks.Find(damageCheckId);
                    db.DamageChecks.Remove(damageCheckDelete);
                    db.SaveChanges();
                    MessageBox.Show("Deleted damage check");
                    db = new ImusCityHallEntities();
                    List <DamageCheck> damageCheckList = new List <DamageCheck>();
                    foreach (var item in db.DamageChecks.Where(m => m.FundBankID == fundBankId))
                    {
                        var damageCheck = new DamageCheck()
                        {
                            DamageCheckId = item.DamageCheckId,
                            CheckNumber   = item.CheckNumber,
                            CreatedDate   = item.CreatedDate
                        };

                        damageCheckList.Add(damageCheck);
                    }
                    damgecheckdg.ItemsSource       = damageCheckList.OrderBy(m => m.CheckNumber);
                    damgecheckdg.SelectedValuePath = "DamageCheckId";
                }
                else
                {
                    MessageBox.Show(SystemClass.DBConnectionErrorMessage);
                }
            }
        }