コード例 #1
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            if (PODropdown.SelectedIndex == -1 || PartNumberDropdown.SelectedIndex == -1 || string.IsNullOrWhiteSpace(UnitPriceTextbox.Text))
            {
                return;
            }
            else if (QtyTextbox.Text == "0")
            {
                ClientHelper.ShowErrorMessage("No quantity to return.");
                return;
            }
            else if (int.Parse(QtyTextbox.Text) > QtyLimit)
            {
                QtyTextbox.Text = QtyLimit.ToString();
                ClientHelper.ShowErrorMessage("Return quantity is greater than original quantity.");
                QtyTextbox.Focus();

                return;
            }
            else if (!UserInfo.IsAdmin && !string.IsNullOrWhiteSpace(UnitPriceTextbox.Text) &&
                     _oldUnitPrice != UnitPriceTextbox.Text.ToDecimal())
            {
                ApprovalForm f = new ApprovalForm();
                f.ApprovalDone += new ApprovalDoneEventHandler(f_ApprovalDone);
                f.Show();
            }
            else
            {
                AddPurchaseReturn();
            }
        }
コード例 #2
0
 private void SaveButton_Click(object sender, EventArgs e)
 {
     if (!this.ValidateChildren())
     {
         ClientHelper.ShowRequiredMessage("Counter Number");
     }
     else if (invoiceList.Count == 0)
     {
         ClientHelper.ShowErrorMessage("No counter items.");
     }
     else if (hasDuplicate)
     {
         ClientHelper.ShowDuplicateMessage("Counter Number");
     }
     else if (DiscountTextbox.Value != 0 && !UserInfo.IsAdmin)
     {
         ApprovalForm f = new ApprovalForm();
         f.ApprovalDone += new ApprovalDoneEventHandler(form_ApprovalDone);
         f.Show();
     }
     else
     {
         SaveCounter();
     }
 }
コード例 #3
0
 private void SaveButton_Click(object sender, EventArgs e)
 {
     if (!this.ValidateChildren())
     {
         ClientHelper.ShowRequiredMessage("Counter Number");
     }
     else if (dataGridView1.SelectedRows.Count == 0)
     {
         ClientHelper.ShowErrorMessage("No items to pay.");
     }
     else if (decimal.Parse(TotalAmountDueTextbox.Text) < 0)
     {
         ClientHelper.ShowErrorMessage("Amount due is less than 0.");
     }
     else if (hasDuplicate)
     {
         ClientHelper.ShowDuplicateMessage("Counter Number");
     }
     else if (DiscountTextbox.Value != 0 && !UserInfo.IsAdmin)
     {
         ApprovalForm f = new ApprovalForm();
         f.ApprovalDone += new ApprovalDoneEventHandler(form_ApprovalDone);
         f.Show();
     }
     else
     {
         SavePayment();
     }
 }
コード例 #4
0
 private void SaveButton_Click(object sender, EventArgs e)
 {
     if (!this.ValidateChildren())
     {
         ClientHelper.ShowRequiredMessage("Auto Part, Part Number, Brand, Model");
     }
     else
     {
         if (AutoPartId != 0)
         {
             int newQty = (int)InitialQtyTextbox.Value;
             if ((newQty != _origQty || string.Compare(_origPartName, AutoPartTextbox.Text) != 0) &&
                 !UserInfo.IsAdmin)
             {
                 ApprovalForm form = new ApprovalForm();
                 form.ApprovalDone += new ApprovalDoneEventHandler(form_ApprovalDone);
                 form.Show();
             }
             else
             {
                 SaveAutoPart();
             }
         }
         else
         {
             SaveAutoPart();
         }
     }
 }
コード例 #5
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            if (!this.ValidateChildren())
            {
                ClientHelper.ShowRequiredMessage("Memo number, Return Items");
            }
            else if (hasDuplicate)
            {
                ClientHelper.ShowDuplicateMessage("Memo number");
            }
            else
            {
                //Approval
                bool needsApproval = false;
                SystemSettings.RefreshApproval();
                if (ReturnId != 0)
                {
                    needsApproval = SystemSettings.Approval["PurchaseReturnEdit"];
                }
                else
                {
                    needsApproval = SystemSettings.Approval["PurchaseReturnAdd"];
                }

                if (!needsApproval)
                {
                    SaveReturn();
                }
                else
                {
                    ApprovalForm form = new ApprovalForm();
                    form.ApprovalDone += new ApprovalDoneEventHandler(form_ApprovalDone);
                    form.Show();
                }
            }
        }
コード例 #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            ApprovalForm form = new ApprovalForm();

            form.ShowDialog();
        }
コード例 #7
0
        public async Task <IActionResult> OnGetAsync(int id)
        {
            var username = HttpContext.Session.GetString("_username");
            var usertype = HttpContext.Session.GetString("_usertype");
            var access   = new Access(username, "Supervisor");

            if (access.IsLogin())
            {
                if (access.IsAuthorize(usertype))
                {
                    WeeklyLog = await _context.WeeklyLog
                                .Where(w => w.DateDeleted == null)
                                .Include(w => w.Project)
                                .FirstOrDefaultAsync(w => w.WeeklyLogId == id);

                    if (WeeklyLog == null)
                    {
                        ErrorMessage = "Weekly Log not found";
                        return(RedirectToPage("/Supervisor/Supervision/Index"));
                    }

                    Supervisor = await _context.Supervisor
                                 .Where(s => s.DateDeleted == null)
                                 .FirstOrDefaultAsync(s => s.AssignedId == WeeklyLog.SupervisorId);

                    if (WeeklyLog.CoSupervisorId != null)
                    {
                        CoSupervisor = await _context.Supervisor
                                       .Where(s => s.DateDeleted == null)
                                       .FirstOrDefaultAsync(s => s.AssignedId == WeeklyLog.CoSupervisorId);

                        if (WeeklyLog.SupervisorId != username && WeeklyLog.CoSupervisorId != username)
                        {
                            ErrorMessage = "This is not your weekly log!";
                            return(RedirectToPage("/Supervisor/Supervision/Index"));
                        }
                    }
                    else
                    {
                        if (WeeklyLog.SupervisorId != username)
                        {
                            ErrorMessage = "This is not your weekly log!";
                            return(RedirectToPage("/Supervisor/Supervision/Index"));
                        }
                    }

                    Student = await _context.Student
                              .Where(s => s.DateDeleted == null)
                              .FirstOrDefaultAsync(s => s.AssignedId == WeeklyLog.StudentId);

                    Af = new ApprovalForm
                    {
                        Comment = WeeklyLog.Comment
                    };

                    CanApprove = false;

                    // only supervisor can approved
                    if (WeeklyLog.SupervisorId == username && (WeeklyLog.WeeklyLogStatus == "New" || WeeklyLog.WeeklyLogStatus == "Modified"))
                    {
                        CanApprove = true;
                    }

                    return(Page());
                }
                else
                {
                    ErrorMessage = "Access Denied";
                    return(RedirectToPage($"/{usertype}/Index"));
                }
            }
            else
            {
                ErrorMessage = "Login Required";
                return(RedirectToPage("/Account/Login"));
            }
        }