コード例 #1
0
 protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
 {
     if (e.Values["IncomingFactureTypeID"].ToString() != IncomingFactureType.GetByCode(IncomingFactureType.ZA_POLISI).ID.ToString())
     {
         e.Values["InsuranceCompanyID"] = null;
     }
     e.Values["UserID"]   = this.PageUser.ID;
     e.Values["BranchID"] = this.PageBranch.ID;
 }
コード例 #2
0
    protected void dvDataSource_Updated(object sender, ObjectDataSourceStatusEventArgs e)
    {
        object          o     = e.ReturnValue;
        IncomingFacture inFac = (IncomingFacture)o;

        if (inFac.IncomingFactureTypeID == IncomingFactureType.GetByCode(IncomingFactureType.ZA_POLISI).ID)
        {
            List <IncomingFacturePolicyItem> lstOld = IncomingFacturePolicyItem.GetByIncomingFactureID(inFac.ID);
            foreach (IncomingFacturePolicyItem ifpi in lstOld)
            {
                ifpi.IsActive = false;
                IncomingFacturePolicyItem.Table.Context.SubmitChanges();
            }
            GridView              gvNewPolicies    = (GridView)DetailsView1.FindControl("gvNewPolicies");
            List <FactureInfo>    lastFactureInfos = listFactureInfos;
            GridViewRowCollection displayedRows    = gvNewPolicies.Rows;
            foreach (GridViewRow gvRow in displayedRows)
            {
                CheckBox    cbIsForFacturing = gvRow.FindControl("cbIsForFacturing") as CheckBox;
                int         factureInfoID    = Convert.ToInt32(gvNewPolicies.DataKeys[gvRow.RowIndex].Value);
                FactureInfo fi = lastFactureInfos.Where(f => f.ID == factureInfoID).SingleOrDefault();
                fi.IsForFacturing = cbIsForFacturing.Checked;
            }
            listFactureInfos = lastFactureInfos;
            List <FactureInfo> listFactureInfo = listFactureInfos.Where(c => c.IsForFacturing == true).ToList();
            foreach (FactureInfo fi in listFactureInfo)
            {
                IncomingFacturePolicyItem ifpi = new IncomingFacturePolicyItem();
                ifpi.IncomingFactureID = inFac.ID;
                ifpi.PolicyItemID      = fi.ID;
                ifpi.IsActive          = true;
                ifpi.Insert();
                PolicyItem pi = PolicyItem.Get(fi.ID);
                pi.PolicyIncomeFactureStatusID = PolicyIncomeFactureStatuse.GetByCode(PolicyIncomeFactureStatuse.CELOSNO_FAKTURIRANA).ID;
                PolicyItem.Table.Context.SubmitChanges();
            }
        }
    }
コード例 #3
0
    protected void ddlIncomingFactureTypes_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList        ddlIncomingFactureTypes = (DropDownList)sender;
        IncomingFactureType ifc = IncomingFactureType.Get(Convert.ToInt32(ddlIncomingFactureTypes.SelectedValue));
        DropDownList        ddlInsuranceCompanies = (DropDownList)DetailsView1.FindControl("ddlInsuranceCompanies");
        TextBox             tbEMBG               = (TextBox)DetailsView1.FindControl("tbEMBG");
        TextBox             tbName               = (TextBox)DetailsView1.FindControl("tbName");
        TextBox             tbAddress            = (TextBox)DetailsView1.FindControl("tbAddress");
        TextBox             tbTaxValue           = (TextBox)DetailsView1.FindControl("tbTaxValue");
        GridView            gvNewPolicies        = (GridView)DetailsView1.FindControl("gvNewPolicies");
        TextBox             tbPolicyNumberToList = (TextBox)DetailsView1.FindControl("tbPolicyNumberToList");
        Button btnAddPolicyToList = (Button)DetailsView1.FindControl("btnAddPolicyToList");

        if (ifc.Code == IncomingFactureType.ZA_POLISI)
        {
            ddlInsuranceCompanies.Visible = true;
            tbEMBG.Enabled               = false;
            tbName.Enabled               = false;
            tbAddress.Enabled            = false;
            gvNewPolicies.Visible        = true;
            tbPolicyNumberToList.Visible = true;
            btnAddPolicyToList.Visible   = true;
            tbTaxValue.Text              = "0";
        }
        else
        {
            ddlInsuranceCompanies.Visible = false;
            tbEMBG.Enabled                      = true;
            tbName.Enabled                      = true;
            tbAddress.Enabled                   = true;
            tbPolicyNumberToList.Visible        = false;
            btnAddPolicyToList.Visible          = false;
            gvNewPolicies.Visible               = false;
            ddlInsuranceCompanies.SelectedIndex = -1;
        }
    }