//Add Target
 public static void Add(Quotation_Target target)
 {
     QuotationEntities entities = new QuotationEntities();
     entities.Quotation_Target.AddObject(target);
     entities.SaveChanges();
     Quotation_Controller.TargetChange((int)target.quotation_id);
 }
 /// <summary>
 /// 將新物件加入 Quotation_Target EntitySet 的方法已被取代。請考慮改為使用關聯的 ObjectSet&lt;T&gt; 屬性的 .Add 方法。
 /// </summary>
 public void AddToQuotation_Target(Quotation_Target quotation_Target)
 {
     base.AddObject("Quotation_Target", quotation_Target);
 }
 /// <summary>
 /// 建立新 Quotation_Target 物件。
 /// </summary>
 /// <param name="quotation_Target_Id">Quotation_Target_Id 屬性的初始值。</param>
 public static Quotation_Target CreateQuotation_Target(global::System.Int32 quotation_Target_Id)
 {
     Quotation_Target quotation_Target = new Quotation_Target();
     quotation_Target.Quotation_Target_Id = quotation_Target_Id;
     return quotation_Target;
 }
    //Modify Test Target
    public static void Modify(Quotation_Target target)
    {
        QuotationEntities entities = new QuotationEntities();
        //entities.AcceptAllChanges();

        var result = (from n in entities.Quotation_Target
                  where n.Quotation_Target_Id == target.Quotation_Target_Id
                  select n).FirstOrDefault();

        result.target_id = target.target_id;
        result.target_description = target.target_description;
        result.country_id = target.country_id;
        result.product_type_id = target.product_type_id;
        result.authority_id = target.authority_id;
        result.technology_id = target.technology_id;
        result.target_rate = target.target_rate;
        result.unit = target.unit;
        result.unit_price = target.unit_price;
        result.discount_type = target.discount_type;
        result.discValue1 = target.discValue1;
        result.discValue2 = target.discValue2;
        result.discPrice = target.discPrice;
        result.FinalPrice = target.FinalPrice;
        result.PayTo = target.PayTo;
        result.Status = target.Status;
        result.Bill = target.Bill;
        result.option1 = target.option1;
        result.option2 = target.option2;
        result.advance1 = target.advance1;
        result.advance2 = target.advance2;
        result.balance1 = target.balance1;
        result.balance2 = target.balance2;
        result.PR_Flag = target.PR_Flag;
        result.Bill1 = target.Bill1;
        result.Bill2 = target.Bill2;
        result.Bill3 = target.Bill3;
        result.BillE = target.BillE;
        entities.SaveChanges();

        Quotation_Controller.TargetChange((int)result.quotation_id);
    }