Exemplo n.º 1
0
    protected void btnCheck_Click(object sender, EventArgs e)
    {
        DateTime           fromDate        = DateTime.Parse(tbStartDate.Text);
        DateTime           toDate          = DateTime.Parse(tbEndDate.Text);
        List <PolicyItem>  oldPiList       = PolicyItem.GetFromPreivousMonthsForAccountFactures(fromDate, int.Parse(ddlInsuranceCompanies.SelectedValue));
        List <FactureInfo> oldFactureInfos = new List <FactureInfo>();

        foreach (PolicyItem pi in oldPiList)
        {
            FactureInfo fi = new FactureInfo();
            fi.ID             = pi.ID;
            fi.IsForFacturing = true;
            fi.PolicyNumber   = pi.PolicyNumber;
            oldFactureInfos.Add(fi);
        }
        listFactureInfos         = oldFactureInfos;
        gvOldPolicies.DataSource = oldFactureInfos;
        gvOldPolicies.Caption    = "Полиси од претходни месеци (" + oldFactureInfos.Count.ToString() + ")";
        gvOldPolicies.DataBind();

        List <PolicyItem>  newPiList       = PolicyItem.GetForAccountFacturingFromCurrentMonth(fromDate, toDate, int.Parse(ddlInsuranceCompanies.SelectedValue));
        List <FactureInfo> newFactureInfos = new List <FactureInfo>();

        foreach (PolicyItem pi in newPiList)
        {
            FactureInfo fi = new FactureInfo();
            fi.ID             = pi.ID;
            fi.IsForFacturing = true;
            fi.PolicyNumber   = pi.PolicyNumber;
            newFactureInfos.Add(fi);
        }
        listNewFactureInfos      = newFactureInfos;
        gvNewPolicies.DataSource = newFactureInfos;
        gvNewPolicies.Caption    = "Полиси од селектираниот период (" + newFactureInfos.Count.ToString() + ")";
        gvNewPolicies.DataBind();
    }