using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for Class_tblDarkhastTamir
/// </summary>
public class Class_tblDarkhastTamir
{
    private String Str_Pelak = String.Empty;
    private String Str_Note = String.Empty;
    private Boolean Bln_ClosedBit = false;
    private String Str_Saat = String.Empty;
    private String Str_DateAnjam = String.Empty;
    private Decimal Dec_TamirID = 0;

    public Class_tblDarkhastTamir(String _Pelak, String _Note, Boolean _ClosedBit, String _Saat , String _DateAnjam)
	{
        this.Str_Pelak = _Pelak;
        this.Str_Note = _Note;
        this.Bln_ClosedBit = _ClosedBit;
        this.Str_Saat = _Saat;
        this.Str_DateAnjam = _DateAnjam;
	}

    public Class_tblDarkhastTamir(Decimal _TamirID ,String _Date, String _Time)
    {
        this.Dec_TamirID = _TamirID;
        this.Str_DateAnjam = _Date;
        this.Str_Saat = _Time;
    }

    public Class_tblDarkhastTamir(Decimal _TamirID)
    {
        this.Dec_TamirID = _TamirID;
    }

    public void UDF_Save()
    {
        LSCTamiratDataContext db = new LSCTamiratDataContext();
        tblDarkhastTamir Darkhst = new tblDarkhastTamir();
        Class_ShamsiTools shamsi = new Class_ShamsiTools();
        shamsi.UDF_GetCurrentShamsiDate();

        Darkhst.PelakNumber = Str_Pelak;
        Darkhst.TamirNote = Str_Note;
        Darkhst.ClosedBit = Bln_ClosedBit;
        Darkhst.DateDarkhastSH = shamsi.CurrentShmasiDate;
        Darkhst.SaatDarkhast = Str_Saat;
        Darkhst.DateAnjamSh = Str_DateAnjam;
        db.tblDarkhastTamirs.InsertOnSubmit(Darkhst);
        db.SubmitChanges();
    }

    public void UDF_UpDate()
    {
        LSCTamiratDataContext db = new LSCTamiratDataContext();
        tblDarkhastTamir Drkhs = db.tblDarkhastTamirs.Single(n => n.TamirID == Dec_TamirID);
        Drkhs.DateAnjamSh = Str_DateAnjam;
        Drkhs.SaatDarkhast = Str_Saat;
        db.SubmitChanges();
    }

    public void UDF_SetClosedBit()
    {
        LSCTamiratDataContext db = new LSCTamiratDataContext();
        tblDarkhastTamir Drkhs = db.tblDarkhastTamirs.Single(n => n.TamirID == Dec_TamirID);
        Drkhs.ClosedBit = Boolean.Parse("false");
        db.SubmitChanges();
    }
  
}