﻿using System.ComponentModel;
using System.Web.Script.Services;
using System.Web.Services;
using TarsimAvlCL;
using TarsimAVLBll;

namespace TarsimAvl.WebService
{
    /// <summary>
    /// Summary description for Shift
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [ScriptService]
    public class Shift : System.Web.Services.WebService
    {

        [WebMethod]
        public ClShiftList GetList(ClShiftFilter obj)
        {
            if (string.IsNullOrEmpty(obj.OrderBy))
            {
                obj.OrderBy = "ShiftID";
                obj.Order = "desc";
            }

            ClShiftList result = TarsimBL.ShiftGetList(obj);
            return result;
        }

        [WebMethod]
        public int AddShift(ClShift obj)
        {
            return TarsimBL.HavePermission(PermissionItem.Shift, PermissionType.CanInsert) ? TarsimBL.AddShift(obj) : 0;
        }

        [WebMethod]
        public int DeleteShift(string id)
        {
            return TarsimBL.HavePermission(PermissionItem.Shift, PermissionType.CanDel) ? TarsimBL.DeleteShift(id) : 0;
        }
    }
}
