using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

/// <summary>
/// Summary description for Class_tblMarjoee
/// </summary>
public class Class_tblMarjoee
{
    Decimal Dec_OrderDetailID = 0;
    int int_StateID = 0;
    String Str_MarjoeeNote = String.Empty;

    public Class_tblMarjoee(Decimal Dec_OrderDetailID, int int_StateID, String Str_MarjoeeNote)
	{
        this.Dec_OrderDetailID = Dec_OrderDetailID;
        this.int_StateID = int_StateID;
        this.Str_MarjoeeNote = Str_MarjoeeNote;
	}

    public void UDF_SaveMarjoee()
    {
        LSC_WareHouseDataContext db = new LSC_WareHouseDataContext();
        tblMarjoee mrj = new tblMarjoee();
        Class_ShamsiTools shDate = new Class_ShamsiTools();
        shDate.UDF_GetCurrentShamsiDate();

        mrj.OrderDetailID = Dec_OrderDetailID;
        mrj.StateID = int_StateID;
        mrj.MarjoeeNote = Str_MarjoeeNote;
        mrj.DateMarjoee = shDate.CurrentShmasiDate;

        db.tblMarjoees.InsertOnSubmit(mrj);
        db.SubmitChanges();
        SetBitMatjoee(Dec_OrderDetailID);

    }

    private void SetBitMatjoee(Decimal Dec_OrderDetailID)
    {
        LSC_WareHouseDataContext db = new LSC_WareHouseDataContext();
        tblOrderDetail ord = db.tblOrderDetails.Single(n => n.OrderDetailID == Dec_OrderDetailID);
        ord.MarjoeeBit = Boolean.Parse("true");
        db.SubmitChanges();
    }






}
