//Add Project
    public static void AddProject(Quotation_Version quot)
    {
        Project project = new Project();
        project.Project_No = DateTime.Now.ToString("yyyyMMdd-HHmmss");
        project.Quotation_Id = quot.Quotation_Version_Id;

        //Add by Adams 2012/4/23 for Project Requirment Change Requirment
        project.Quotation_No = quot.Quotation_No;

        project.Create_Date = DateTime.Now;
        project.Project_Status = "Open";

        QuotationEntities entities = new QuotationEntities();
        entities.Project.AddObject(project);
        entities.SaveChanges();
    }
 /// <summary>
 /// 將新物件加入 Quotation_Version EntitySet 的方法已被取代。請考慮改為使用關聯的 ObjectSet&lt;T&gt; 屬性的 .Add 方法。
 /// </summary>
 public void AddToQuotation_Version(Quotation_Version quotation_Version)
 {
     base.AddObject("Quotation_Version", quotation_Version);
 }
 /// <summary>
 /// 建立新 Quotation_Version 物件。
 /// </summary>
 /// <param name="quotation_Version_Id">Quotation_Version_Id 屬性的初始值。</param>
 public static Quotation_Version CreateQuotation_Version(global::System.Int32 quotation_Version_Id)
 {
     Quotation_Version quotation_Version = new Quotation_Version();
     quotation_Version.Quotation_Version_Id = quotation_Version_Id;
     return quotation_Version;
 }
    public int Save()
    {
        Quotation_Version obj = new Quotation_Version();

        obj.Quotation_No = DateTime.Now.ToString("yyyyMMdd-HHmmss");
        obj.Vername = 1;
        obj.Quotation_OpenDate = DateTime.Now;
        //obj.revise_date-
        obj.create_user = Page.User.Identity.Name;
        employee emp = CodeTableController.GetEmployee(Page.User.Identity.Name);
        obj.create_user_ID = emp.id;
        obj.create_date = DateTime.Now;
        //obj.modify_user=Page.User.Identity.Name;
        //obj.modify_user_ID
        //obj.modify_date
        obj.Quotation_Status = 1;
        obj.Quotation_Statusdate = DateTime.Now;
        ////obj.Quotation_Statusby
        //obj.Quotation_StatusbyID
        //obj.Payment_Method_Id = Int32.Parse(ddlPaymentMethod.SelectedValue);
        //obj.pocheckno
        //obj.paymentlimit
        obj.SalesId = Int32.Parse(DropDownListEmp.SelectedValue);
        obj.Currency = RadioButtonListCurrency.Text;
        obj.Product_Name = txtProductName.Text;
        obj.CProduct_Name = txtCProductName.Text;
        obj.Model_No = txtModelNo.Text;
        obj.CModel_No = txtCModelNo.Text;
        obj.Brand_Name = txtBrandName.Text;
        obj.CBrand_Name = txtCBrandName.Text;
        obj.Model_Difference = txtModelDifference.Text;
        obj.CModel_Difference = txtCModelDifferencev.Text;
        obj.Client_Id = Int32.Parse(DropDownListClient.SelectedValue);

        int ContactID;
        if (Int32.TryParse(DropDownListContact.SelectedValue, out ContactID))
          obj.Client_Contact = ContactID;
        else
          obj.Client_Contact = null;
        obj.Applicant_Id = Int32.Parse(DropDownListApp.SelectedValue);
        //obj.Applicant_Contact
        obj.Bill_Name = txtBill_Name.Text;
        obj.Bill_Title = txtBill_Title.Text;
        obj.Bill_Companyname = txtBillCompanyname.Text;
        obj.Bill_CName = txtBill_CName.Text;
        obj.Bill_CTitle = txtBill_CTitle.Text;
        obj.Bill_CCompanyname = txtBill_CCompanyname.Text;
        obj.Bill_Phone = txtBill_Phone.Text;
        obj.Bill_Email = txtBill_Email.Text;
        obj.Bill_Country = txtBill_Country.Text;
        obj.Bill_Address = txtBill_Address.Text;
        obj.Bill_CAddress = txtBill_CAddress.Text;
        obj.Total_disc_amt = 0;
        obj.Max_Q_Authorize_Amt = 0;
        obj.Waiting_Approve_UserID = -1;
        //obj.Approve
        //obj.Approved_Date
        //obj.ApprovedBy
        //obj.Remark
        //obj.Request_approval_date
        //obj.Sent_date
        //obj.Confirmed_date
        //obj.Lost_date
        //obj.Cancelled_date
        //obj.On_hold_date
        //obj.Done_date
        //obj.Total_disc_amt
        //obj.Payment_Days = txtPayment_Days.Text;
        obj.Payment_Days = ddlPaymentDays.Text;
        obj.Payment_Term = ddlPayment_Term.Text;
        obj.Client_Status = txtClient_Status.Text;
        obj.DHL_Acct = txtDHL.Text;
        int AccessLevelID;
        if (Int32.TryParse(ddlAccessLevel.SelectedValue, out AccessLevelID))
          obj.Access_Level_ID = AccessLevelID;
        else
          obj.Access_Level_ID = null;

        obj.Specification = txtSpecification.Text; //Adams: add at 2015/4/2

        int QuotationID = Quotation_Controller.Add_Quotation(obj);

        if (QuotationIDChanged != null)
        {
          QuotationIDChanged(this, QuotationID);
        }
        return QuotationID;
    }