コード例 #1
0
 protected void GridViewResults_SelectedIndexChanged(object sender, EventArgs e)
 {
     WebUserControlCustomerRelationContract1.DataBind();
     WebUserControlCustomerRelationContract1.KeyID = new System.Guid(GridViewResults.SelectedDataKey.Value.ToString());
     LabelContractID.Text = WebUserControlCustomerRelationContract1.KeyID.ToString();
     WebUserControlCustomerRelationContract1.Visible = true;
     DetailTable.Visible = true;
 }
コード例 #2
0
        protected void ButtonNewContractMaterial_Click(object sender, EventArgs e)
        {
            if (WebUserControlCustomerRelationContract1.SaveData(true))
            {
                RelationContractMaterial NewObj = new RelationContractMaterial();
                ModelTMSContainer        Temp   = new ModelTMSContainer(Session["CustomerConnectString"].ToString(), Session);
                EntityKey        TempKey        = new EntityKey("ModelTMSContainer.RelationContractSet", "Id", WebUserControlCustomerRelationContract1.KeyID);
                RelationContract TempObj        = Temp.GetObjectByKey(TempKey) as RelationContract;

                NewObj.RelationContract = TempObj;
                NewObj.Material         = Temp.MaterialSet.First();
                NewObj.Description      = "Nieuw materiaal";

                Temp.AddToRelationContractMaterialSet(NewObj);
                Temp.SaveChanges(SaveOptions.DetectChangesBeforeSave);

                RefreshContractMaterials();
            }
        }