protected void ButtonNew_Click(object sender, EventArgs e)
        {
            RelationContract  NewObj  = new RelationContract();
            ModelTMSContainer Temp    = new ModelTMSContainer(Session["CustomerConnectString"].ToString(), Session);
            EntityKey         TempKey = new EntityKey("ModelTMSContainer.RelationSet", "Id", Guid.Parse(Request.Params["Id"]));
            Relation          TempObj = Temp.GetObjectByKey(TempKey) as Relation;

            NewObj.Relation = TempObj;

            NewObj.ContractDate      = Common.CurrentClientDate(Session);
            NewObj.ContractStartDate = Common.CurrentClientDate(Session);
            NewObj.ContractEndDate   = Common.CurrentClientDate(Session).AddMonths(1);

            NewObj.ContractType     = "Buy";
            NewObj.ContractPriority = 5;
            NewObj.ContractStatus   = "Open";

            NewObj.YourReference      = "";
            NewObj.PaymentConditions  = "";
            NewObj.DeliveryConditions = "";

            NewObj.HasContractGuidance = false;

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

            WebUserControlCustomerRelationContract1.KeyID = NewObj.Id;
            LabelContractID.Text = WebUserControlCustomerRelationContract1.KeyID.ToString();
            WebUserControlCustomerRelationContract1.Visible = true;
            DetailTable.Visible = true;
        }
Ejemplo n.º 2
0
 public async Task <IActionResult> FindPaths([FromBody] RelationContract relation)
 {
     try
     {
         return(Ok(await _manager.Neo4J.FindAllPaths(relation.First, relation.Second)));
     }
     catch (Exception e)
     {
         return(BadRequest(_response.SetStatus(false, $"NOK. {e.Message}")));
     }
 }
Ejemplo n.º 3
0
        protected void Page_PreRender(object Sender, EventArgs e)
        {
            // if contractguidance is active then set the right warning color
            LabelContractGuidanceFeedback.Visible          = false;
            CheckBox_HasContractGuidance_Checked.BackColor = LabelHasContractGuidance.BackColor;
            if ((DataItem != null) && ((DataItem as RelationContract).HasContractGuidance))
            {
                RelationContract         rcm  = DataItem as RelationContract;
                ContractGuidanceFillType cgft = rcm.ContractGuidanceFilled();
                LabelContractGuidanceFeedback.Visible = true;

                switch (cgft)
                {
                case ContractGuidanceFillType.NotEnoughToReachMin:
                    CheckBox_HasContractGuidance_Checked.BackColor = Color.Red;
                    if (rcm.ContractType == "Buy")
                    {
                        LabelContractGuidanceFeedback.Text = "Nog onvoldoende materiaal aanwezig voor aankoop";
                    }
                    else
                    {
                        LabelContractGuidanceFeedback.Text = "Nog onvoldoende materiaal aanwezig voor uitlevering";
                    }
                    break;

                case ContractGuidanceFillType.BetweenMinAndMax:
                    CheckBox_HasContractGuidance_Checked.BackColor = Color.Orange;
                    LabelContractGuidanceFeedback.Text             = "Tussen min en max hoeveelheid aanwezig";
                    break;

                case ContractGuidanceFillType.Filled:
                    CheckBox_HasContractGuidance_Checked.BackColor = Color.Green;
                    if (rcm.ContractType == "Buy")
                    {
                        LabelContractGuidanceFeedback.Text = "Voldoende materiaal aanwezig voor aankoop";
                    }
                    else
                    {
                        LabelContractGuidanceFeedback.Text = "Voldoende materiaal aanwezig voor uitlevering";
                    }
                    break;
                }
            }
        }
        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();
            }
        }
Ejemplo n.º 5
0
        protected void Page_PreRender(object Sender, EventArgs e)
        {
            if (DataItem != null)
            {
                RelationContractMaterial rcm = DataItem as RelationContractMaterial;
                RelationContract         rc  = rcm.RelationContract;

                if (rc != null)
                {
                    LabelOnContract.Visible = rc.HasContractGuidance;
                    LabelOnContract_AvgStockUnits.Visible       = rc.HasContractGuidance;
                    LabelOnContractPrice.Visible                = rc.HasContractGuidance;
                    LabelOnContractAvgPricePerUnit.Visible      = rc.HasContractGuidance;
                    LabelRequiredProfitContractGuidance.Visible = rc.HasContractGuidance;
                    TextBox_AvgRequiredProfitPerUnit.Visible    = rc.HasContractGuidance;

                    if (rc.HasContractGuidance)
                    {
                        LabelOnContractAvgPricePerUnit.Text = rcm.AvgStockUnitPrice().ToString();
                    }
                }
            }
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> LinkSubnets([FromBody] RelationContract contract)
        {
            try
            {
                if (!Regex.IsMatch(contract.First, @"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/\d{1,2}$"))
                {
                    return(Ok(_response.SetStatus(true, $"OK. Invalid ip format in \"{contract.First}\"")));
                }

                if (!Regex.IsMatch(contract.Second, @"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/\d{1,2}$"))
                {
                    return(Ok(_response.SetStatus(true, $"OK. Invalid ip format in \"{contract.Second}\"")));
                }

                await _manager.Neo4J.CreateRelation(new NodeEntity(contract.First, true),
                                                    new NodeEntity(contract.Second, true));

                return(Ok(_response.SetStatus(true, "OK")));
            }
            catch (Exception e)
            {
                return(BadRequest(_response.SetStatus(false, $"NOK. {e.Message}")));
            }
        }