Exemplo n.º 1
0
 protected void gvForPayments_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Payment")
     {
         int selIndex = Convert.ToInt32(e.CommandArgument);
         gvForPayments.SelectedIndex             = selIndex;
         ViewState["gvForPaymentsSelectedValue"] = gvForPayments.SelectedValue;
         BankslipItem bi = BankslipItem.Get(Convert.ToInt32(gvForPayments.SelectedValue));
         if (bi.IsPaid)
         {
             RegisterStartupScript("myAlert", "<script>alert('Ставката од изводот веќе е евидентирана во плаќања на полисите!')</script>");
             ViewState["ClientID"]        = null;
             btnInsertNewPayments.Enabled = false;
             return;
         }
         if (bi.DemandValue > 0)
         {
             ClientAccount ca = ClientAccount.GetByAccountNumber(bi.ClientAccountNumber);
             if (ca != null)
             {
                 List <FinCardSaldo> lst = Policy.GetForFinCard(ca.ClientID, "OpenItems");
                 if (lst.Count > 0)
                 {
                     ViewState["ClientID"] = ca.ClientID;
                     gvNewPayments.DataBind();
                     SetNewPaidValue(lst, bi.DemandValue);
                     btnInsertNewPayments.Enabled = true;
                 }
                 else
                 {
                     RegisterStartupScript("myAlert", "<script>alert('Не постојат неплатени полиси за клиентот!')</script>");
                     ViewState["ClientID"]        = null;
                     btnInsertNewPayments.Enabled = false;
                 }
             }
             else
             {
                 RegisterStartupScript("myAlert", "<script>alert('Не постои сметката!')</script>");
                 ViewState["ClientID"]        = null;
                 btnInsertNewPayments.Enabled = false;
             }
         }
         else
         {
             RegisterStartupScript("myAlert", "<script>alert('Износот во ставката на изводот не е внесен како побарува!')</script>");
             ViewState["ClientID"]        = null;
             btnInsertNewPayments.Enabled = false;
         }
     }
 }