Beispiel #1
0
 protected void gvwMaster_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "EditRow")
         {
             int id = Convert.ToInt32(e.CommandArgument);
             RowID = id;
             mvwForm.SetActiveView(viwAddEdit);
             PackageHeader package = packageProvider.Get(id);
             ddlDuesInMonth.SelectedValue = package.PackageDuesInMonth.ToString();
             txtName.Text        = package.Name;
             chkIsActive.Checked = package.IsActive;
             Detail             = packageProvider.GetDetail(id).ToList();
             chkOpenEnd.Checked = package.OpenEnd;
             txtFreezeFee.Text  = Convert.ToString(package.FreezeFee);
             RefreshDetail();
             txtName.Focus();
         }
         else if (e.CommandName == "DefineClass")
         {
             int id = Convert.ToInt32(e.CommandArgument);
             RowID = id;
             mvwForm.SetActiveView(viwAddEdit2);
             RefreshActiveClassInPackages();
         }
     }
     catch (Exception ex)
     {
         mvwForm.SetActiveView(viwRead);
         WebFormHelper.SetLabelTextWithCssClass(lblMessage, ex.Message, LabelStyleNames.ErrorMessage);
     }
 }
    protected void ddlPackage_SelectedIndexChanged(object sender, EventArgs e)
    {
        var package = packageProvider.GetDetail(Convert.ToInt32(ddlPackage.SelectedValue));

        gvwPackage.DataSource = package;
        gvwPackage.DataBind();
    }
    //[System.Web.Services.WebMethod]
    //public static void PM_LoadPackageDetail(string contractNo)
    //{
    //    using (FitnessDataContext ctx = new FitnessDataContext())
    //    {
    //        ContractProvider contractProvider = new ContractProvider(ctx);
    //        PackageProvider packageProvider = new PackageProvider(ctx);
    //        PackageHeader pkg = contractProvider.GetPackageInContract(contractNo);
    //        IEnumerable<PackageDetailViewModel> package = packageProvider.GetDetail(pkg.ID);
    //        page._PackageDetail = package.ToList();
    //        page.gvwPackage.DataSource = package;
    //        page.gvwPackage.DataBind();
    //        page.CalculateTotalInvoiceAndPayment();
    //        page.txtNotes.Text = contractNo;
    //    }
    //}

    private void LoadPackageDetail()
    {
        PackageHeader pkg = contractProvider.GetPackageInContract(txtContractNo.Text);
        IEnumerable <PackageDetailViewModel> package = packageProvider.GetDetail(pkg.ID);

        _PackageDetail        = package.ToList();
        gvwPackage.DataSource = package;
        gvwPackage.DataBind();
        CalculateTotalInvoiceAndPayment();

        lblPackage.Text = pkg.Name;
    }