//------------------------------------------------------------------------------
// <auto-generated>
//    This code was generated from a template.
//
//    Manual changes to this file may cause unexpected behavior in your application.
//    Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace DataAccess
{
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Infrastructure;
    using System.Data.Objects;
    using System.Data.Objects.DataClasses;
    using System.Linq;
    
    public partial class NikaiDSREntities : DbContext
    {
        public NikaiDSREntities()
            : base("name=NikaiDSREntities")
        {
        }
    
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            throw new UnintentionalCodeFirstException();
        }
    
        public DbSet<Absent> Absents { get; set; }
        public DbSet<Country> Countries { get; set; }
        public DbSet<Customer> Customers { get; set; }
        public DbSet<DSR> DSRs { get; set; }
        public DbSet<DSR_Header> DSR_Header { get; set; }
        public DbSet<Holiday> Holidays { get; set; }
        public DbSet<Manager_Executive> Manager_Executive { get; set; }
        public DbSet<Menu> Menus { get; set; }
        public DbSet<MenuAccess> MenuAccesses { get; set; }
        public DbSet<MenuRolePage> MenuRolePages { get; set; }
        public DbSet<Parameter> Parameters { get; set; }
        public DbSet<Region> Regions { get; set; }
        public DbSet<Role> Roles { get; set; }
        public DbSet<RoleRight> RoleRights { get; set; }
        public DbSet<Site_User> Site_User { get; set; }
        public DbSet<sysdiagram> sysdiagrams { get; set; }
        public DbSet<Target> Targets { get; set; }
        public DbSet<UserRoleLocationRegionCountryView> UserRoleLocationRegionCountryViews { get; set; }
        public DbSet<User_Language> User_Language { get; set; }
        public DbSet<ParameterDet> ParameterDets { get; set; }
        public DbSet<Location> Locations { get; set; }
        public DbSet<Contact> Contacts { get; set; }
        public DbSet<DSRReportView> DSRReportViews { get; set; }
        public DbSet<ActiveContactCustomerLocationView> ActiveContactCustomerLocationViews { get; set; }
        public DbSet<ActiveCustomerLocationRegionCountryView> ActiveCustomerLocationRegionCountryViews { get; set; }
        public DbSet<DsrContactCustomerLocationView> DsrContactCustomerLocationViews { get; set; }
    
        public virtual ObjectResult<ActiveCustomerLocationRegionCountry_Result> ActiveCustomerLocationRegionCountry(Nullable<int> user_Id)
        {
            var user_IdParameter = user_Id.HasValue ?
                new ObjectParameter("User_Id", user_Id) :
                new ObjectParameter("User_Id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<ActiveCustomerLocationRegionCountry_Result>("ActiveCustomerLocationRegionCountry", user_IdParameter);
        }
    
        public virtual int ChangePassword(Nullable<int> user_Id, string password)
        {
            var user_IdParameter = user_Id.HasValue ?
                new ObjectParameter("User_Id", user_Id) :
                new ObjectParameter("User_Id", typeof(int));
    
            var passwordParameter = password != null ?
                new ObjectParameter("Password", password) :
                new ObjectParameter("Password", typeof(string));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("ChangePassword", user_IdParameter, passwordParameter);
        }
    
        public virtual ObjectResult<GetAbsent_Result> GetAbsent(Nullable<int> absent_Id, Nullable<System.DateTime> date, Nullable<int> site_User_Id)
        {
            var absent_IdParameter = absent_Id.HasValue ?
                new ObjectParameter("Absent_Id", absent_Id) :
                new ObjectParameter("Absent_Id", typeof(int));
    
            var dateParameter = date.HasValue ?
                new ObjectParameter("Date", date) :
                new ObjectParameter("Date", typeof(System.DateTime));
    
            var site_User_IdParameter = site_User_Id.HasValue ?
                new ObjectParameter("Site_User_Id", site_User_Id) :
                new ObjectParameter("Site_User_Id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetAbsent_Result>("GetAbsent", absent_IdParameter, dateParameter, site_User_IdParameter);
        }
    
        public virtual ObjectResult<GetAttendance_Result> GetAttendance(Nullable<int> datePeriod, Nullable<System.DateTime> specificDate, Nullable<int> user_Id)
        {
            var datePeriodParameter = datePeriod.HasValue ?
                new ObjectParameter("DatePeriod", datePeriod) :
                new ObjectParameter("DatePeriod", typeof(int));
    
            var specificDateParameter = specificDate.HasValue ?
                new ObjectParameter("SpecificDate", specificDate) :
                new ObjectParameter("SpecificDate", typeof(System.DateTime));
    
            var user_IdParameter = user_Id.HasValue ?
                new ObjectParameter("User_Id", user_Id) :
                new ObjectParameter("User_Id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetAttendance_Result>("GetAttendance", datePeriodParameter, specificDateParameter, user_IdParameter);
        }
    
        public virtual ObjectResult<GetCountry_Result> GetCountry(Nullable<int> country_Id, string country_Name)
        {
            var country_IdParameter = country_Id.HasValue ?
                new ObjectParameter("Country_Id", country_Id) :
                new ObjectParameter("Country_Id", typeof(int));
    
            var country_NameParameter = country_Name != null ?
                new ObjectParameter("Country_Name", country_Name) :
                new ObjectParameter("Country_Name", typeof(string));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetCountry_Result>("GetCountry", country_IdParameter, country_NameParameter);
        }
    
        public virtual ObjectResult<GetDSRHeader_Result> GetDSRHeader(Nullable<int> dSR_Head_Id, Nullable<System.DateTime> date, string shift, Nullable<System.TimeSpan> morning_Time_In, Nullable<System.TimeSpan> morning_Time_Out, Nullable<System.TimeSpan> evening_Time_In, Nullable<System.TimeSpan> evening_Time_Out, string comments, Nullable<int> site_User_Id)
        {
            var dSR_Head_IdParameter = dSR_Head_Id.HasValue ?
                new ObjectParameter("DSR_Head_Id", dSR_Head_Id) :
                new ObjectParameter("DSR_Head_Id", typeof(int));
    
            var dateParameter = date.HasValue ?
                new ObjectParameter("Date", date) :
                new ObjectParameter("Date", typeof(System.DateTime));
    
            var shiftParameter = shift != null ?
                new ObjectParameter("Shift", shift) :
                new ObjectParameter("Shift", typeof(string));
    
            var morning_Time_InParameter = morning_Time_In.HasValue ?
                new ObjectParameter("Morning_Time_In", morning_Time_In) :
                new ObjectParameter("Morning_Time_In", typeof(System.TimeSpan));
    
            var morning_Time_OutParameter = morning_Time_Out.HasValue ?
                new ObjectParameter("Morning_Time_Out", morning_Time_Out) :
                new ObjectParameter("Morning_Time_Out", typeof(System.TimeSpan));
    
            var evening_Time_InParameter = evening_Time_In.HasValue ?
                new ObjectParameter("Evening_Time_In", evening_Time_In) :
                new ObjectParameter("Evening_Time_In", typeof(System.TimeSpan));
    
            var evening_Time_OutParameter = evening_Time_Out.HasValue ?
                new ObjectParameter("Evening_Time_Out", evening_Time_Out) :
                new ObjectParameter("Evening_Time_Out", typeof(System.TimeSpan));
    
            var commentsParameter = comments != null ?
                new ObjectParameter("Comments", comments) :
                new ObjectParameter("Comments", typeof(string));
    
            var site_User_IdParameter = site_User_Id.HasValue ?
                new ObjectParameter("Site_User_Id", site_User_Id) :
                new ObjectParameter("Site_User_Id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetDSRHeader_Result>("GetDSRHeader", dSR_Head_IdParameter, dateParameter, shiftParameter, morning_Time_InParameter, morning_Time_OutParameter, evening_Time_InParameter, evening_Time_OutParameter, commentsParameter, site_User_IdParameter);
        }
    
        public virtual ObjectResult<GetHoliday_Result> GetHoliday(Nullable<int> holiday_Id, Nullable<System.DateTime> date, Nullable<int> country_Id, Nullable<int> holiday_Type)
        {
            var holiday_IdParameter = holiday_Id.HasValue ?
                new ObjectParameter("Holiday_Id", holiday_Id) :
                new ObjectParameter("Holiday_Id", typeof(int));
    
            var dateParameter = date.HasValue ?
                new ObjectParameter("Date", date) :
                new ObjectParameter("Date", typeof(System.DateTime));
    
            var country_IdParameter = country_Id.HasValue ?
                new ObjectParameter("Country_Id", country_Id) :
                new ObjectParameter("Country_Id", typeof(int));
    
            var holiday_TypeParameter = holiday_Type.HasValue ?
                new ObjectParameter("Holiday_Type", holiday_Type) :
                new ObjectParameter("Holiday_Type", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetHoliday_Result>("GetHoliday", holiday_IdParameter, dateParameter, country_IdParameter, holiday_TypeParameter);
        }
    
        public virtual ObjectResult<GetRegion_Result> GetRegion(Nullable<int> region_Id, string region_Name, Nullable<int> country_Id)
        {
            var region_IdParameter = region_Id.HasValue ?
                new ObjectParameter("Region_Id", region_Id) :
                new ObjectParameter("Region_Id", typeof(int));
    
            var region_NameParameter = region_Name != null ?
                new ObjectParameter("Region_Name", region_Name) :
                new ObjectParameter("Region_Name", typeof(string));
    
            var country_IdParameter = country_Id.HasValue ?
                new ObjectParameter("Country_Id", country_Id) :
                new ObjectParameter("Country_Id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetRegion_Result>("GetRegion", region_IdParameter, region_NameParameter, country_IdParameter);
        }
    
        public virtual ObjectResult<GetRole_Result> GetRole(Nullable<int> role_Id, string role_Name)
        {
            var role_IdParameter = role_Id.HasValue ?
                new ObjectParameter("Role_Id", role_Id) :
                new ObjectParameter("Role_Id", typeof(int));
    
            var role_NameParameter = role_Name != null ?
                new ObjectParameter("Role_Name", role_Name) :
                new ObjectParameter("Role_Name", typeof(string));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetRole_Result>("GetRole", role_IdParameter, role_NameParameter);
        }
    
        public virtual ObjectResult<GetRoleRights_Result> GetRoleRights(Nullable<int> roleId)
        {
            var roleIdParameter = roleId.HasValue ?
                new ObjectParameter("RoleId", roleId) :
                new ObjectParameter("RoleId", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetRoleRights_Result>("GetRoleRights", roleIdParameter);
        }
    
        public virtual ObjectResult<GetSiteUser_Result> GetSiteUser(Nullable<int> site_User_Id, Nullable<int> role_Id, Nullable<int> location_Id, string login_Name, string email)
        {
            var site_User_IdParameter = site_User_Id.HasValue ?
                new ObjectParameter("Site_User_Id", site_User_Id) :
                new ObjectParameter("Site_User_Id", typeof(int));
    
            var role_IdParameter = role_Id.HasValue ?
                new ObjectParameter("Role_Id", role_Id) :
                new ObjectParameter("Role_Id", typeof(int));
    
            var location_IdParameter = location_Id.HasValue ?
                new ObjectParameter("Location_Id", location_Id) :
                new ObjectParameter("Location_Id", typeof(int));
    
            var login_NameParameter = login_Name != null ?
                new ObjectParameter("Login_Name", login_Name) :
                new ObjectParameter("Login_Name", typeof(string));
    
            var emailParameter = email != null ?
                new ObjectParameter("Email", email) :
                new ObjectParameter("Email", typeof(string));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetSiteUser_Result>("GetSiteUser", site_User_IdParameter, role_IdParameter, location_IdParameter, login_NameParameter, emailParameter);
        }
    
        public virtual ObjectResult<GetTarget_Result> GetTarget(Nullable<int> user_Id, Nullable<int> target_Id, Nullable<int> month, Nullable<int> year, Nullable<int> sales, Nullable<int> collection, Nullable<int> secondary_Sales)
        {
            var user_IdParameter = user_Id.HasValue ?
                new ObjectParameter("User_Id", user_Id) :
                new ObjectParameter("User_Id", typeof(int));
    
            var target_IdParameter = target_Id.HasValue ?
                new ObjectParameter("Target_Id", target_Id) :
                new ObjectParameter("Target_Id", typeof(int));
    
            var monthParameter = month.HasValue ?
                new ObjectParameter("Month", month) :
                new ObjectParameter("Month", typeof(int));
    
            var yearParameter = year.HasValue ?
                new ObjectParameter("Year", year) :
                new ObjectParameter("Year", typeof(int));
    
            var salesParameter = sales.HasValue ?
                new ObjectParameter("Sales", sales) :
                new ObjectParameter("Sales", typeof(int));
    
            var collectionParameter = collection.HasValue ?
                new ObjectParameter("Collection", collection) :
                new ObjectParameter("Collection", typeof(int));
    
            var secondary_SalesParameter = secondary_Sales.HasValue ?
                new ObjectParameter("Secondary_Sales", secondary_Sales) :
                new ObjectParameter("Secondary_Sales", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetTarget_Result>("GetTarget", user_IdParameter, target_IdParameter, monthParameter, yearParameter, salesParameter, collectionParameter, secondary_SalesParameter);
        }
    
        public virtual ObjectResult<GetUserRoleLocationRegionCountry_Result> GetUserRoleLocationRegionCountry(Nullable<int> user_Id, string userName, string email, Nullable<bool> status, Nullable<int> roleId, string roleName, Nullable<int> locationId, string locationName, Nullable<int> regionId, string regionName, Nullable<int> countryId, string countryName)
        {
            var user_IdParameter = user_Id.HasValue ?
                new ObjectParameter("User_Id", user_Id) :
                new ObjectParameter("User_Id", typeof(int));
    
            var userNameParameter = userName != null ?
                new ObjectParameter("UserName", userName) :
                new ObjectParameter("UserName", typeof(string));
    
            var emailParameter = email != null ?
                new ObjectParameter("Email", email) :
                new ObjectParameter("Email", typeof(string));
    
            var statusParameter = status.HasValue ?
                new ObjectParameter("Status", status) :
                new ObjectParameter("Status", typeof(bool));
    
            var roleIdParameter = roleId.HasValue ?
                new ObjectParameter("RoleId", roleId) :
                new ObjectParameter("RoleId", typeof(int));
    
            var roleNameParameter = roleName != null ?
                new ObjectParameter("RoleName", roleName) :
                new ObjectParameter("RoleName", typeof(string));
    
            var locationIdParameter = locationId.HasValue ?
                new ObjectParameter("LocationId", locationId) :
                new ObjectParameter("LocationId", typeof(int));
    
            var locationNameParameter = locationName != null ?
                new ObjectParameter("LocationName", locationName) :
                new ObjectParameter("LocationName", typeof(string));
    
            var regionIdParameter = regionId.HasValue ?
                new ObjectParameter("RegionId", regionId) :
                new ObjectParameter("RegionId", typeof(int));
    
            var regionNameParameter = regionName != null ?
                new ObjectParameter("RegionName", regionName) :
                new ObjectParameter("RegionName", typeof(string));
    
            var countryIdParameter = countryId.HasValue ?
                new ObjectParameter("CountryId", countryId) :
                new ObjectParameter("CountryId", typeof(int));
    
            var countryNameParameter = countryName != null ?
                new ObjectParameter("CountryName", countryName) :
                new ObjectParameter("CountryName", typeof(string));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetUserRoleLocationRegionCountry_Result>("GetUserRoleLocationRegionCountry", user_IdParameter, userNameParameter, emailParameter, statusParameter, roleIdParameter, roleNameParameter, locationIdParameter, locationNameParameter, regionIdParameter, regionNameParameter, countryIdParameter, countryNameParameter);
        }
    
        public virtual int InsertLocation(string location_Name, Nullable<int> region_Id)
        {
            var location_NameParameter = location_Name != null ?
                new ObjectParameter("Location_Name", location_Name) :
                new ObjectParameter("Location_Name", typeof(string));
    
            var region_IdParameter = region_Id.HasValue ?
                new ObjectParameter("Region_Id", region_Id) :
                new ObjectParameter("Region_Id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("InsertLocation", location_NameParameter, region_IdParameter);
        }
    
        public virtual int InsertRegion(string region_Name, Nullable<int> country_Id)
        {
            var region_NameParameter = region_Name != null ?
                new ObjectParameter("Region_Name", region_Name) :
                new ObjectParameter("Region_Name", typeof(string));
    
            var country_IdParameter = country_Id.HasValue ?
                new ObjectParameter("Country_Id", country_Id) :
                new ObjectParameter("Country_Id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("InsertRegion", region_NameParameter, country_IdParameter);
        }
    
        public virtual int InsertUpdateAbsent(Nullable<int> absent_Id, Nullable<System.DateTime> date, Nullable<int> site_User_Id)
        {
            var absent_IdParameter = absent_Id.HasValue ?
                new ObjectParameter("Absent_Id", absent_Id) :
                new ObjectParameter("Absent_Id", typeof(int));
    
            var dateParameter = date.HasValue ?
                new ObjectParameter("Date", date) :
                new ObjectParameter("Date", typeof(System.DateTime));
    
            var site_User_IdParameter = site_User_Id.HasValue ?
                new ObjectParameter("Site_User_Id", site_User_Id) :
                new ObjectParameter("Site_User_Id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("InsertUpdateAbsent", absent_IdParameter, dateParameter, site_User_IdParameter);
        }
    
        public virtual int InsertUpdateCountry(Nullable<int> country_Id, string country_Name)
        {
            var country_IdParameter = country_Id.HasValue ?
                new ObjectParameter("Country_Id", country_Id) :
                new ObjectParameter("Country_Id", typeof(int));
    
            var country_NameParameter = country_Name != null ?
                new ObjectParameter("Country_Name", country_Name) :
                new ObjectParameter("Country_Name", typeof(string));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("InsertUpdateCountry", country_IdParameter, country_NameParameter);
        }
    
        public virtual int InsertUpdateDSR(Nullable<int> dSR_Id, Nullable<int> site_User_Id, Nullable<System.DateTime> date, Nullable<int> contact_Id, Nullable<int> objective, Nullable<System.TimeSpan> time_In, Nullable<System.TimeSpan> time_Out, Nullable<int> time_Spent, Nullable<int> time_w_Merchandiser, Nullable<int> collection, Nullable<int> secondary_Sales, Nullable<int> sales_LPO_Received, Nullable<int> discount, Nullable<int> sales_Return, string remarks)
        {
            var dSR_IdParameter = dSR_Id.HasValue ?
                new ObjectParameter("DSR_Id", dSR_Id) :
                new ObjectParameter("DSR_Id", typeof(int));
    
            var site_User_IdParameter = site_User_Id.HasValue ?
                new ObjectParameter("Site_User_Id", site_User_Id) :
                new ObjectParameter("Site_User_Id", typeof(int));
    
            var dateParameter = date.HasValue ?
                new ObjectParameter("Date", date) :
                new ObjectParameter("Date", typeof(System.DateTime));
    
            var contact_IdParameter = contact_Id.HasValue ?
                new ObjectParameter("Contact_Id", contact_Id) :
                new ObjectParameter("Contact_Id", typeof(int));
    
            var objectiveParameter = objective.HasValue ?
                new ObjectParameter("Objective", objective) :
                new ObjectParameter("Objective", typeof(int));
    
            var time_InParameter = time_In.HasValue ?
                new ObjectParameter("Time_In", time_In) :
                new ObjectParameter("Time_In", typeof(System.TimeSpan));
    
            var time_OutParameter = time_Out.HasValue ?
                new ObjectParameter("Time_Out", time_Out) :
                new ObjectParameter("Time_Out", typeof(System.TimeSpan));
    
            var time_SpentParameter = time_Spent.HasValue ?
                new ObjectParameter("Time_Spent", time_Spent) :
                new ObjectParameter("Time_Spent", typeof(int));
    
            var time_w_MerchandiserParameter = time_w_Merchandiser.HasValue ?
                new ObjectParameter("Time_w_Merchandiser", time_w_Merchandiser) :
                new ObjectParameter("Time_w_Merchandiser", typeof(int));
    
            var collectionParameter = collection.HasValue ?
                new ObjectParameter("Collection", collection) :
                new ObjectParameter("Collection", typeof(int));
    
            var secondary_SalesParameter = secondary_Sales.HasValue ?
                new ObjectParameter("Secondary_Sales", secondary_Sales) :
                new ObjectParameter("Secondary_Sales", typeof(int));
    
            var sales_LPO_ReceivedParameter = sales_LPO_Received.HasValue ?
                new ObjectParameter("Sales_LPO_Received", sales_LPO_Received) :
                new ObjectParameter("Sales_LPO_Received", typeof(int));
    
            var discountParameter = discount.HasValue ?
                new ObjectParameter("Discount", discount) :
                new ObjectParameter("Discount", typeof(int));
    
            var sales_ReturnParameter = sales_Return.HasValue ?
                new ObjectParameter("Sales_Return", sales_Return) :
                new ObjectParameter("Sales_Return", typeof(int));
    
            var remarksParameter = remarks != null ?
                new ObjectParameter("Remarks", remarks) :
                new ObjectParameter("Remarks", typeof(string));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("InsertUpdateDSR", dSR_IdParameter, site_User_IdParameter, dateParameter, contact_IdParameter, objectiveParameter, time_InParameter, time_OutParameter, time_SpentParameter, time_w_MerchandiserParameter, collectionParameter, secondary_SalesParameter, sales_LPO_ReceivedParameter, discountParameter, sales_ReturnParameter, remarksParameter);
        }
    
        public virtual int InsertUpdateDSRHeader(Nullable<int> dSR_Head_Id, Nullable<System.DateTime> date, string shift, Nullable<System.TimeSpan> morning_Time_In, Nullable<System.TimeSpan> morning_Time_Out, Nullable<System.TimeSpan> evening_Time_In, Nullable<System.TimeSpan> evening_Time_Out, string comments, Nullable<int> site_User_Id)
        {
            var dSR_Head_IdParameter = dSR_Head_Id.HasValue ?
                new ObjectParameter("DSR_Head_Id", dSR_Head_Id) :
                new ObjectParameter("DSR_Head_Id", typeof(int));
    
            var dateParameter = date.HasValue ?
                new ObjectParameter("Date", date) :
                new ObjectParameter("Date", typeof(System.DateTime));
    
            var shiftParameter = shift != null ?
                new ObjectParameter("Shift", shift) :
                new ObjectParameter("Shift", typeof(string));
    
            var morning_Time_InParameter = morning_Time_In.HasValue ?
                new ObjectParameter("Morning_Time_In", morning_Time_In) :
                new ObjectParameter("Morning_Time_In", typeof(System.TimeSpan));
    
            var morning_Time_OutParameter = morning_Time_Out.HasValue ?
                new ObjectParameter("Morning_Time_Out", morning_Time_Out) :
                new ObjectParameter("Morning_Time_Out", typeof(System.TimeSpan));
    
            var evening_Time_InParameter = evening_Time_In.HasValue ?
                new ObjectParameter("Evening_Time_In", evening_Time_In) :
                new ObjectParameter("Evening_Time_In", typeof(System.TimeSpan));
    
            var evening_Time_OutParameter = evening_Time_Out.HasValue ?
                new ObjectParameter("Evening_Time_Out", evening_Time_Out) :
                new ObjectParameter("Evening_Time_Out", typeof(System.TimeSpan));
    
            var commentsParameter = comments != null ?
                new ObjectParameter("Comments", comments) :
                new ObjectParameter("Comments", typeof(string));
    
            var site_User_IdParameter = site_User_Id.HasValue ?
                new ObjectParameter("Site_User_Id", site_User_Id) :
                new ObjectParameter("Site_User_Id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("InsertUpdateDSRHeader", dSR_Head_IdParameter, dateParameter, shiftParameter, morning_Time_InParameter, morning_Time_OutParameter, evening_Time_InParameter, evening_Time_OutParameter, commentsParameter, site_User_IdParameter);
        }
    
        public virtual int InsertUpdateHoliday(Nullable<int> holiday_Id, Nullable<System.DateTime> date, Nullable<int> country_Id, Nullable<int> holiday_Type)
        {
            var holiday_IdParameter = holiday_Id.HasValue ?
                new ObjectParameter("Holiday_Id", holiday_Id) :
                new ObjectParameter("Holiday_Id", typeof(int));
    
            var dateParameter = date.HasValue ?
                new ObjectParameter("Date", date) :
                new ObjectParameter("Date", typeof(System.DateTime));
    
            var country_IdParameter = country_Id.HasValue ?
                new ObjectParameter("Country_Id", country_Id) :
                new ObjectParameter("Country_Id", typeof(int));
    
            var holiday_TypeParameter = holiday_Type.HasValue ?
                new ObjectParameter("Holiday_Type", holiday_Type) :
                new ObjectParameter("Holiday_Type", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("InsertUpdateHoliday", holiday_IdParameter, dateParameter, country_IdParameter, holiday_TypeParameter);
        }
    
        public virtual int InsertUpdateManagerExecutive(Nullable<int> manager_Exec_Id, Nullable<int> manager_Id, Nullable<int> executive_Id)
        {
            var manager_Exec_IdParameter = manager_Exec_Id.HasValue ?
                new ObjectParameter("Manager_Exec_Id", manager_Exec_Id) :
                new ObjectParameter("Manager_Exec_Id", typeof(int));
    
            var manager_IdParameter = manager_Id.HasValue ?
                new ObjectParameter("Manager_Id", manager_Id) :
                new ObjectParameter("Manager_Id", typeof(int));
    
            var executive_IdParameter = executive_Id.HasValue ?
                new ObjectParameter("Executive_Id", executive_Id) :
                new ObjectParameter("Executive_Id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("InsertUpdateManagerExecutive", manager_Exec_IdParameter, manager_IdParameter, executive_IdParameter);
        }
    
        public virtual int InsertUpdateRole(Nullable<int> role_Id, Nullable<int> role_Name)
        {
            var role_IdParameter = role_Id.HasValue ?
                new ObjectParameter("Role_Id", role_Id) :
                new ObjectParameter("Role_Id", typeof(int));
    
            var role_NameParameter = role_Name.HasValue ?
                new ObjectParameter("Role_Name", role_Name) :
                new ObjectParameter("Role_Name", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("InsertUpdateRole", role_IdParameter, role_NameParameter);
        }
    
        public virtual int InsertUpdateSiteUser(Nullable<int> site_User_Id, Nullable<int> role_Id, Nullable<int> location_Id, string name, string login_Name, string passsword, string email, Nullable<bool> status, string employee_Code)
        {
            var site_User_IdParameter = site_User_Id.HasValue ?
                new ObjectParameter("Site_User_Id", site_User_Id) :
                new ObjectParameter("Site_User_Id", typeof(int));
    
            var role_IdParameter = role_Id.HasValue ?
                new ObjectParameter("Role_Id", role_Id) :
                new ObjectParameter("Role_Id", typeof(int));
    
            var location_IdParameter = location_Id.HasValue ?
                new ObjectParameter("Location_Id", location_Id) :
                new ObjectParameter("Location_Id", typeof(int));
    
            var nameParameter = name != null ?
                new ObjectParameter("Name", name) :
                new ObjectParameter("Name", typeof(string));
    
            var login_NameParameter = login_Name != null ?
                new ObjectParameter("Login_Name", login_Name) :
                new ObjectParameter("Login_Name", typeof(string));
    
            var passswordParameter = passsword != null ?
                new ObjectParameter("Passsword", passsword) :
                new ObjectParameter("Passsword", typeof(string));
    
            var emailParameter = email != null ?
                new ObjectParameter("Email", email) :
                new ObjectParameter("Email", typeof(string));
    
            var statusParameter = status.HasValue ?
                new ObjectParameter("Status", status) :
                new ObjectParameter("Status", typeof(bool));
    
            var employee_CodeParameter = employee_Code != null ?
                new ObjectParameter("Employee_Code", employee_Code) :
                new ObjectParameter("Employee_Code", typeof(string));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("InsertUpdateSiteUser", site_User_IdParameter, role_IdParameter, location_IdParameter, nameParameter, login_NameParameter, passswordParameter, emailParameter, statusParameter, employee_CodeParameter);
        }
    
        public virtual int InsertUpdateTarget(Nullable<int> target_Id, Nullable<int> month, Nullable<int> year, Nullable<int> sales, Nullable<int> collection, Nullable<int> secondary_Sales, Nullable<int> site_User_Id)
        {
            var target_IdParameter = target_Id.HasValue ?
                new ObjectParameter("Target_Id", target_Id) :
                new ObjectParameter("Target_Id", typeof(int));
    
            var monthParameter = month.HasValue ?
                new ObjectParameter("Month", month) :
                new ObjectParameter("Month", typeof(int));
    
            var yearParameter = year.HasValue ?
                new ObjectParameter("Year", year) :
                new ObjectParameter("Year", typeof(int));
    
            var salesParameter = sales.HasValue ?
                new ObjectParameter("Sales", sales) :
                new ObjectParameter("Sales", typeof(int));
    
            var collectionParameter = collection.HasValue ?
                new ObjectParameter("Collection", collection) :
                new ObjectParameter("Collection", typeof(int));
    
            var secondary_SalesParameter = secondary_Sales.HasValue ?
                new ObjectParameter("Secondary_Sales", secondary_Sales) :
                new ObjectParameter("Secondary_Sales", typeof(int));
    
            var site_User_IdParameter = site_User_Id.HasValue ?
                new ObjectParameter("Site_User_Id", site_User_Id) :
                new ObjectParameter("Site_User_Id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("InsertUpdateTarget", target_IdParameter, monthParameter, yearParameter, salesParameter, collectionParameter, secondary_SalesParameter, site_User_IdParameter);
        }
    
        public virtual int sp_alterdiagram(string diagramname, Nullable<int> owner_id, Nullable<int> version, byte[] definition)
        {
            var diagramnameParameter = diagramname != null ?
                new ObjectParameter("diagramname", diagramname) :
                new ObjectParameter("diagramname", typeof(string));
    
            var owner_idParameter = owner_id.HasValue ?
                new ObjectParameter("owner_id", owner_id) :
                new ObjectParameter("owner_id", typeof(int));
    
            var versionParameter = version.HasValue ?
                new ObjectParameter("version", version) :
                new ObjectParameter("version", typeof(int));
    
            var definitionParameter = definition != null ?
                new ObjectParameter("definition", definition) :
                new ObjectParameter("definition", typeof(byte[]));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_alterdiagram", diagramnameParameter, owner_idParameter, versionParameter, definitionParameter);
        }
    
        public virtual int sp_creatediagram(string diagramname, Nullable<int> owner_id, Nullable<int> version, byte[] definition)
        {
            var diagramnameParameter = diagramname != null ?
                new ObjectParameter("diagramname", diagramname) :
                new ObjectParameter("diagramname", typeof(string));
    
            var owner_idParameter = owner_id.HasValue ?
                new ObjectParameter("owner_id", owner_id) :
                new ObjectParameter("owner_id", typeof(int));
    
            var versionParameter = version.HasValue ?
                new ObjectParameter("version", version) :
                new ObjectParameter("version", typeof(int));
    
            var definitionParameter = definition != null ?
                new ObjectParameter("definition", definition) :
                new ObjectParameter("definition", typeof(byte[]));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_creatediagram", diagramnameParameter, owner_idParameter, versionParameter, definitionParameter);
        }
    
        public virtual int sp_dropdiagram(string diagramname, Nullable<int> owner_id)
        {
            var diagramnameParameter = diagramname != null ?
                new ObjectParameter("diagramname", diagramname) :
                new ObjectParameter("diagramname", typeof(string));
    
            var owner_idParameter = owner_id.HasValue ?
                new ObjectParameter("owner_id", owner_id) :
                new ObjectParameter("owner_id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_dropdiagram", diagramnameParameter, owner_idParameter);
        }
    
        public virtual ObjectResult<sp_helpdiagramdefinition_Result> sp_helpdiagramdefinition(string diagramname, Nullable<int> owner_id)
        {
            var diagramnameParameter = diagramname != null ?
                new ObjectParameter("diagramname", diagramname) :
                new ObjectParameter("diagramname", typeof(string));
    
            var owner_idParameter = owner_id.HasValue ?
                new ObjectParameter("owner_id", owner_id) :
                new ObjectParameter("owner_id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<sp_helpdiagramdefinition_Result>("sp_helpdiagramdefinition", diagramnameParameter, owner_idParameter);
        }
    
        public virtual ObjectResult<sp_helpdiagrams_Result> sp_helpdiagrams(string diagramname, Nullable<int> owner_id)
        {
            var diagramnameParameter = diagramname != null ?
                new ObjectParameter("diagramname", diagramname) :
                new ObjectParameter("diagramname", typeof(string));
    
            var owner_idParameter = owner_id.HasValue ?
                new ObjectParameter("owner_id", owner_id) :
                new ObjectParameter("owner_id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<sp_helpdiagrams_Result>("sp_helpdiagrams", diagramnameParameter, owner_idParameter);
        }
    
        public virtual int sp_renamediagram(string diagramname, Nullable<int> owner_id, string new_diagramname)
        {
            var diagramnameParameter = diagramname != null ?
                new ObjectParameter("diagramname", diagramname) :
                new ObjectParameter("diagramname", typeof(string));
    
            var owner_idParameter = owner_id.HasValue ?
                new ObjectParameter("owner_id", owner_id) :
                new ObjectParameter("owner_id", typeof(int));
    
            var new_diagramnameParameter = new_diagramname != null ?
                new ObjectParameter("new_diagramname", new_diagramname) :
                new ObjectParameter("new_diagramname", typeof(string));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_renamediagram", diagramnameParameter, owner_idParameter, new_diagramnameParameter);
        }
    
        public virtual int sp_upgraddiagrams()
        {
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("sp_upgraddiagrams");
        }
    
        public virtual int UpdateLocation(Nullable<int> location_Id, string location_Name, Nullable<int> region_Id)
        {
            var location_IdParameter = location_Id.HasValue ?
                new ObjectParameter("Location_Id", location_Id) :
                new ObjectParameter("Location_Id", typeof(int));
    
            var location_NameParameter = location_Name != null ?
                new ObjectParameter("Location_Name", location_Name) :
                new ObjectParameter("Location_Name", typeof(string));
    
            var region_IdParameter = region_Id.HasValue ?
                new ObjectParameter("Region_Id", region_Id) :
                new ObjectParameter("Region_Id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("UpdateLocation", location_IdParameter, location_NameParameter, region_IdParameter);
        }
    
        public virtual int UpdateRegion(Nullable<int> region_Id, string region_Name, Nullable<int> country_Id)
        {
            var region_IdParameter = region_Id.HasValue ?
                new ObjectParameter("Region_Id", region_Id) :
                new ObjectParameter("Region_Id", typeof(int));
    
            var region_NameParameter = region_Name != null ?
                new ObjectParameter("Region_Name", region_Name) :
                new ObjectParameter("Region_Name", typeof(string));
    
            var country_IdParameter = country_Id.HasValue ?
                new ObjectParameter("Country_Id", country_Id) :
                new ObjectParameter("Country_Id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("UpdateRegion", region_IdParameter, region_NameParameter, country_IdParameter);
        }
    
        public virtual int InsertUpdateLinkedExecutive(Nullable<int> user_Id, string linkedUsers)
        {
            var user_IdParameter = user_Id.HasValue ?
                new ObjectParameter("User_Id", user_Id) :
                new ObjectParameter("User_Id", typeof(int));
    
            var linkedUsersParameter = linkedUsers != null ?
                new ObjectParameter("LinkedUsers", linkedUsers) :
                new ObjectParameter("LinkedUsers", typeof(string));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("InsertUpdateLinkedExecutive", user_IdParameter, linkedUsersParameter);
        }
    
        public virtual ObjectResult<GetAttendanceAndDSR_Result> GetAttendanceAndDSR(Nullable<int> datePeriod, Nullable<System.DateTime> specificDate, Nullable<int> user_Id, Nullable<int> search_User_Id)
        {
            var datePeriodParameter = datePeriod.HasValue ?
                new ObjectParameter("DatePeriod", datePeriod) :
                new ObjectParameter("DatePeriod", typeof(int));
    
            var specificDateParameter = specificDate.HasValue ?
                new ObjectParameter("SpecificDate", specificDate) :
                new ObjectParameter("SpecificDate", typeof(System.DateTime));
    
            var user_IdParameter = user_Id.HasValue ?
                new ObjectParameter("User_Id", user_Id) :
                new ObjectParameter("User_Id", typeof(int));
    
            var search_User_IdParameter = search_User_Id.HasValue ?
                new ObjectParameter("Search_User_Id", search_User_Id) :
                new ObjectParameter("Search_User_Id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetAttendanceAndDSR_Result>("GetAttendanceAndDSR", datePeriodParameter, specificDateParameter, user_IdParameter, search_User_IdParameter);
        }
    
        public virtual ObjectResult<GetUser_Result> GetUser(Nullable<int> userId, string userName, string password)
        {
            var userIdParameter = userId.HasValue ?
                new ObjectParameter("UserId", userId) :
                new ObjectParameter("UserId", typeof(int));
    
            var userNameParameter = userName != null ?
                new ObjectParameter("UserName", userName) :
                new ObjectParameter("UserName", typeof(string));
    
            var passwordParameter = password != null ?
                new ObjectParameter("Password", password) :
                new ObjectParameter("Password", typeof(string));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetUser_Result>("GetUser", userIdParameter, userNameParameter, passwordParameter);
        }
    
        public virtual ObjectResult<GetParameter_Result> GetParameter(Nullable<int> parameterId, Nullable<int> parameterDetId, Nullable<int> parameterValue)
        {
            var parameterIdParameter = parameterId.HasValue ?
                new ObjectParameter("ParameterId", parameterId) :
                new ObjectParameter("ParameterId", typeof(int));
    
            var parameterDetIdParameter = parameterDetId.HasValue ?
                new ObjectParameter("ParameterDetId", parameterDetId) :
                new ObjectParameter("ParameterDetId", typeof(int));
    
            var parameterValueParameter = parameterValue.HasValue ?
                new ObjectParameter("ParameterValue", parameterValue) :
                new ObjectParameter("ParameterValue", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetParameter_Result>("GetParameter", parameterIdParameter, parameterDetIdParameter, parameterValueParameter);
        }
    
        public virtual ObjectResult<GetLocation_Result> GetLocation(Nullable<int> location_Id, string location_Name, Nullable<int> region_Id)
        {
            var location_IdParameter = location_Id.HasValue ?
                new ObjectParameter("Location_Id", location_Id) :
                new ObjectParameter("Location_Id", typeof(int));
    
            var location_NameParameter = location_Name != null ?
                new ObjectParameter("Location_Name", location_Name) :
                new ObjectParameter("Location_Name", typeof(string));
    
            var region_IdParameter = region_Id.HasValue ?
                new ObjectParameter("Region_Id", region_Id) :
                new ObjectParameter("Region_Id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetLocation_Result>("GetLocation", location_IdParameter, location_NameParameter, region_IdParameter);
        }
    
        public virtual ObjectResult<GetContact_Result> GetContact(Nullable<int> contact_Id, string contact_Name, string contact_Name_BL, Nullable<int> customer_Id, string department, string department_BL, Nullable<int> mobile, Nullable<int> status)
        {
            var contact_IdParameter = contact_Id.HasValue ?
                new ObjectParameter("Contact_Id", contact_Id) :
                new ObjectParameter("Contact_Id", typeof(int));
    
            var contact_NameParameter = contact_Name != null ?
                new ObjectParameter("Contact_Name", contact_Name) :
                new ObjectParameter("Contact_Name", typeof(string));
    
            var contact_Name_BLParameter = contact_Name_BL != null ?
                new ObjectParameter("Contact_Name_BL", contact_Name_BL) :
                new ObjectParameter("Contact_Name_BL", typeof(string));
    
            var customer_IdParameter = customer_Id.HasValue ?
                new ObjectParameter("Customer_Id", customer_Id) :
                new ObjectParameter("Customer_Id", typeof(int));
    
            var departmentParameter = department != null ?
                new ObjectParameter("Department", department) :
                new ObjectParameter("Department", typeof(string));
    
            var department_BLParameter = department_BL != null ?
                new ObjectParameter("Department_BL", department_BL) :
                new ObjectParameter("Department_BL", typeof(string));
    
            var mobileParameter = mobile.HasValue ?
                new ObjectParameter("Mobile", mobile) :
                new ObjectParameter("Mobile", typeof(int));
    
            var statusParameter = status.HasValue ?
                new ObjectParameter("Status", status) :
                new ObjectParameter("Status", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetContact_Result>("GetContact", contact_IdParameter, contact_NameParameter, contact_Name_BLParameter, customer_IdParameter, departmentParameter, department_BLParameter, mobileParameter, statusParameter);
        }
    
        public virtual ObjectResult<Nullable<decimal>> InsertUpdateContact(Nullable<int> contact_Id, string contact_Name, string contact_Name_BL, Nullable<int> customer_Id, string department, string department_BL, string mobile, Nullable<bool> status, ObjectParameter cont_Id)
        {
            var contact_IdParameter = contact_Id.HasValue ?
                new ObjectParameter("Contact_Id", contact_Id) :
                new ObjectParameter("Contact_Id", typeof(int));
    
            var contact_NameParameter = contact_Name != null ?
                new ObjectParameter("Contact_Name", contact_Name) :
                new ObjectParameter("Contact_Name", typeof(string));
    
            var contact_Name_BLParameter = contact_Name_BL != null ?
                new ObjectParameter("Contact_Name_BL", contact_Name_BL) :
                new ObjectParameter("Contact_Name_BL", typeof(string));
    
            var customer_IdParameter = customer_Id.HasValue ?
                new ObjectParameter("Customer_Id", customer_Id) :
                new ObjectParameter("Customer_Id", typeof(int));
    
            var departmentParameter = department != null ?
                new ObjectParameter("Department", department) :
                new ObjectParameter("Department", typeof(string));
    
            var department_BLParameter = department_BL != null ?
                new ObjectParameter("Department_BL", department_BL) :
                new ObjectParameter("Department_BL", typeof(string));
    
            var mobileParameter = mobile != null ?
                new ObjectParameter("Mobile", mobile) :
                new ObjectParameter("Mobile", typeof(string));
    
            var statusParameter = status.HasValue ?
                new ObjectParameter("Status", status) :
                new ObjectParameter("Status", typeof(bool));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<Nullable<decimal>>("InsertUpdateContact", contact_IdParameter, contact_NameParameter, contact_Name_BLParameter, customer_IdParameter, departmentParameter, department_BLParameter, mobileParameter, statusParameter, cont_Id);
        }
    
        public virtual ObjectResult<GetActiveDsrContactCustomerLocation_Result> GetActiveDsrContactCustomerLocation(Nullable<int> user_Id, Nullable<System.DateTime> date)
        {
            var user_IdParameter = user_Id.HasValue ?
                new ObjectParameter("User_Id", user_Id) :
                new ObjectParameter("User_Id", typeof(int));
    
            var dateParameter = date.HasValue ?
                new ObjectParameter("Date", date) :
                new ObjectParameter("Date", typeof(System.DateTime));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetActiveDsrContactCustomerLocation_Result>("GetActiveDsrContactCustomerLocation", user_IdParameter, dateParameter);
        }
    
        public virtual ObjectResult<GetExecutiveTargetsActuals_Result> GetExecutiveTargetsActuals(Nullable<int> month, Nullable<int> year, Nullable<int> executive_Id)
        {
            var monthParameter = month.HasValue ?
                new ObjectParameter("Month", month) :
                new ObjectParameter("Month", typeof(int));
    
            var yearParameter = year.HasValue ?
                new ObjectParameter("Year", year) :
                new ObjectParameter("Year", typeof(int));
    
            var executive_IdParameter = executive_Id.HasValue ?
                new ObjectParameter("Executive_Id", executive_Id) :
                new ObjectParameter("Executive_Id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetExecutiveTargetsActuals_Result>("GetExecutiveTargetsActuals", monthParameter, yearParameter, executive_IdParameter);
        }
    
        public virtual ObjectResult<GetManagerReport_Result> GetManagerReport(Nullable<System.DateTime> fromDate, Nullable<System.DateTime> toDate, Nullable<int> country_Id, Nullable<int> region_Id, Nullable<int> location_Id, Nullable<bool> keyAccounts, Nullable<int> manager_Id, Nullable<int> search_Executive_Id, Nullable<bool> report_ExecutiveWise)
        {
            var fromDateParameter = fromDate.HasValue ?
                new ObjectParameter("FromDate", fromDate) :
                new ObjectParameter("FromDate", typeof(System.DateTime));
    
            var toDateParameter = toDate.HasValue ?
                new ObjectParameter("ToDate", toDate) :
                new ObjectParameter("ToDate", typeof(System.DateTime));
    
            var country_IdParameter = country_Id.HasValue ?
                new ObjectParameter("Country_Id", country_Id) :
                new ObjectParameter("Country_Id", typeof(int));
    
            var region_IdParameter = region_Id.HasValue ?
                new ObjectParameter("Region_Id", region_Id) :
                new ObjectParameter("Region_Id", typeof(int));
    
            var location_IdParameter = location_Id.HasValue ?
                new ObjectParameter("Location_Id", location_Id) :
                new ObjectParameter("Location_Id", typeof(int));
    
            var keyAccountsParameter = keyAccounts.HasValue ?
                new ObjectParameter("KeyAccounts", keyAccounts) :
                new ObjectParameter("KeyAccounts", typeof(bool));
    
            var manager_IdParameter = manager_Id.HasValue ?
                new ObjectParameter("Manager_Id", manager_Id) :
                new ObjectParameter("Manager_Id", typeof(int));
    
            var search_Executive_IdParameter = search_Executive_Id.HasValue ?
                new ObjectParameter("Search_Executive_Id", search_Executive_Id) :
                new ObjectParameter("Search_Executive_Id", typeof(int));
    
            var report_ExecutiveWiseParameter = report_ExecutiveWise.HasValue ?
                new ObjectParameter("Report_ExecutiveWise", report_ExecutiveWise) :
                new ObjectParameter("Report_ExecutiveWise", typeof(bool));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetManagerReport_Result>("GetManagerReport", fromDateParameter, toDateParameter, country_IdParameter, region_IdParameter, location_IdParameter, keyAccountsParameter, manager_IdParameter, search_Executive_IdParameter, report_ExecutiveWiseParameter);
        }
    
        public virtual ObjectResult<GetManagerExecutive_Result> GetManagerExecutive(Nullable<int> manager_Id, Nullable<int> executive_Id)
        {
            var manager_IdParameter = manager_Id.HasValue ?
                new ObjectParameter("Manager_Id", manager_Id) :
                new ObjectParameter("Manager_Id", typeof(int));
    
            var executive_IdParameter = executive_Id.HasValue ?
                new ObjectParameter("Executive_Id", executive_Id) :
                new ObjectParameter("Executive_Id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetManagerExecutive_Result>("GetManagerExecutive", manager_IdParameter, executive_IdParameter);
        }
    
        public virtual ObjectResult<GetActiveCustomerLocationRegionCountry_Result> GetActiveCustomerLocationRegionCountry(Nullable<int> user_Id)
        {
            var user_IdParameter = user_Id.HasValue ?
                new ObjectParameter("User_Id", user_Id) :
                new ObjectParameter("User_Id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetActiveCustomerLocationRegionCountry_Result>("GetActiveCustomerLocationRegionCountry", user_IdParameter);
        }
    
        public virtual ObjectResult<GetContactWithCustName_Result> GetContactWithCustName(Nullable<int> contact_Id, string contact_Name, string customer_Name, string contact_Name_BL, Nullable<int> customer_Id, string department, string department_BL, string mobile, Nullable<int> status)
        {
            var contact_IdParameter = contact_Id.HasValue ?
                new ObjectParameter("Contact_Id", contact_Id) :
                new ObjectParameter("Contact_Id", typeof(int));
    
            var contact_NameParameter = contact_Name != null ?
                new ObjectParameter("Contact_Name", contact_Name) :
                new ObjectParameter("Contact_Name", typeof(string));
    
            var customer_NameParameter = customer_Name != null ?
                new ObjectParameter("Customer_Name", customer_Name) :
                new ObjectParameter("Customer_Name", typeof(string));
    
            var contact_Name_BLParameter = contact_Name_BL != null ?
                new ObjectParameter("Contact_Name_BL", contact_Name_BL) :
                new ObjectParameter("Contact_Name_BL", typeof(string));
    
            var customer_IdParameter = customer_Id.HasValue ?
                new ObjectParameter("Customer_Id", customer_Id) :
                new ObjectParameter("Customer_Id", typeof(int));
    
            var departmentParameter = department != null ?
                new ObjectParameter("Department", department) :
                new ObjectParameter("Department", typeof(string));
    
            var department_BLParameter = department_BL != null ?
                new ObjectParameter("Department_BL", department_BL) :
                new ObjectParameter("Department_BL", typeof(string));
    
            var mobileParameter = mobile != null ?
                new ObjectParameter("Mobile", mobile) :
                new ObjectParameter("Mobile", typeof(string));
    
            var statusParameter = status.HasValue ?
                new ObjectParameter("Status", status) :
                new ObjectParameter("Status", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetContactWithCustName_Result>("GetContactWithCustName", contact_IdParameter, contact_NameParameter, customer_NameParameter, contact_Name_BLParameter, customer_IdParameter, departmentParameter, department_BLParameter, mobileParameter, statusParameter);
        }
    
        public virtual int InsertVisit(Nullable<int> customer_Id, string customer_Name, string customer_Name_BL, Nullable<int> location_Id, Nullable<int> contact_Id, string contact_Name, string contact_Name_BL, string department, string department_BL, string mobile, Nullable<int> site_User_Id, Nullable<System.DateTime> date, Nullable<int> objective, Nullable<System.TimeSpan> time_In, Nullable<System.TimeSpan> time_Out, Nullable<int> time_w_Merchandiser, Nullable<int> collection, Nullable<int> secondary_Sales, Nullable<int> sales_LPO_Received, Nullable<int> discount, Nullable<int> sales_Return, string remarks, Nullable<int> updated_By)
        {
            var customer_IdParameter = customer_Id.HasValue ?
                new ObjectParameter("Customer_Id", customer_Id) :
                new ObjectParameter("Customer_Id", typeof(int));
    
            var customer_NameParameter = customer_Name != null ?
                new ObjectParameter("Customer_Name", customer_Name) :
                new ObjectParameter("Customer_Name", typeof(string));
    
            var customer_Name_BLParameter = customer_Name_BL != null ?
                new ObjectParameter("Customer_Name_BL", customer_Name_BL) :
                new ObjectParameter("Customer_Name_BL", typeof(string));
    
            var location_IdParameter = location_Id.HasValue ?
                new ObjectParameter("Location_Id", location_Id) :
                new ObjectParameter("Location_Id", typeof(int));
    
            var contact_IdParameter = contact_Id.HasValue ?
                new ObjectParameter("Contact_Id", contact_Id) :
                new ObjectParameter("Contact_Id", typeof(int));
    
            var contact_NameParameter = contact_Name != null ?
                new ObjectParameter("Contact_Name", contact_Name) :
                new ObjectParameter("Contact_Name", typeof(string));
    
            var contact_Name_BLParameter = contact_Name_BL != null ?
                new ObjectParameter("Contact_Name_BL", contact_Name_BL) :
                new ObjectParameter("Contact_Name_BL", typeof(string));
    
            var departmentParameter = department != null ?
                new ObjectParameter("Department", department) :
                new ObjectParameter("Department", typeof(string));
    
            var department_BLParameter = department_BL != null ?
                new ObjectParameter("Department_BL", department_BL) :
                new ObjectParameter("Department_BL", typeof(string));
    
            var mobileParameter = mobile != null ?
                new ObjectParameter("Mobile", mobile) :
                new ObjectParameter("Mobile", typeof(string));
    
            var site_User_IdParameter = site_User_Id.HasValue ?
                new ObjectParameter("Site_User_Id", site_User_Id) :
                new ObjectParameter("Site_User_Id", typeof(int));
    
            var dateParameter = date.HasValue ?
                new ObjectParameter("Date", date) :
                new ObjectParameter("Date", typeof(System.DateTime));
    
            var objectiveParameter = objective.HasValue ?
                new ObjectParameter("Objective", objective) :
                new ObjectParameter("Objective", typeof(int));
    
            var time_InParameter = time_In.HasValue ?
                new ObjectParameter("Time_In", time_In) :
                new ObjectParameter("Time_In", typeof(System.TimeSpan));
    
            var time_OutParameter = time_Out.HasValue ?
                new ObjectParameter("Time_Out", time_Out) :
                new ObjectParameter("Time_Out", typeof(System.TimeSpan));
    
            var time_w_MerchandiserParameter = time_w_Merchandiser.HasValue ?
                new ObjectParameter("Time_w_Merchandiser", time_w_Merchandiser) :
                new ObjectParameter("Time_w_Merchandiser", typeof(int));
    
            var collectionParameter = collection.HasValue ?
                new ObjectParameter("Collection", collection) :
                new ObjectParameter("Collection", typeof(int));
    
            var secondary_SalesParameter = secondary_Sales.HasValue ?
                new ObjectParameter("Secondary_Sales", secondary_Sales) :
                new ObjectParameter("Secondary_Sales", typeof(int));
    
            var sales_LPO_ReceivedParameter = sales_LPO_Received.HasValue ?
                new ObjectParameter("Sales_LPO_Received", sales_LPO_Received) :
                new ObjectParameter("Sales_LPO_Received", typeof(int));
    
            var discountParameter = discount.HasValue ?
                new ObjectParameter("Discount", discount) :
                new ObjectParameter("Discount", typeof(int));
    
            var sales_ReturnParameter = sales_Return.HasValue ?
                new ObjectParameter("Sales_Return", sales_Return) :
                new ObjectParameter("Sales_Return", typeof(int));
    
            var remarksParameter = remarks != null ?
                new ObjectParameter("Remarks", remarks) :
                new ObjectParameter("Remarks", typeof(string));
    
            var updated_ByParameter = updated_By.HasValue ?
                new ObjectParameter("Updated_By", updated_By) :
                new ObjectParameter("Updated_By", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("InsertVisit", customer_IdParameter, customer_NameParameter, customer_Name_BLParameter, location_IdParameter, contact_IdParameter, contact_NameParameter, contact_Name_BLParameter, departmentParameter, department_BLParameter, mobileParameter, site_User_IdParameter, dateParameter, objectiveParameter, time_InParameter, time_OutParameter, time_w_MerchandiserParameter, collectionParameter, secondary_SalesParameter, sales_LPO_ReceivedParameter, discountParameter, sales_ReturnParameter, remarksParameter, updated_ByParameter);
        }
    
        public virtual ObjectResult<GetDSR_Result> GetDSR(Nullable<int> dSR_Id, Nullable<int> site_User_Id, Nullable<System.DateTime> date, Nullable<int> contact_Id, Nullable<int> objective, Nullable<System.TimeSpan> time_In, Nullable<System.TimeSpan> time_Out, Nullable<int> time_Spent, Nullable<int> time_w_Merchandiser, Nullable<int> collection, Nullable<int> secondary_Sales, Nullable<int> sales_LPO_Received, Nullable<int> discount, Nullable<int> sales_Return, string remarks)
        {
            var dSR_IdParameter = dSR_Id.HasValue ?
                new ObjectParameter("DSR_Id", dSR_Id) :
                new ObjectParameter("DSR_Id", typeof(int));
    
            var site_User_IdParameter = site_User_Id.HasValue ?
                new ObjectParameter("Site_User_Id", site_User_Id) :
                new ObjectParameter("Site_User_Id", typeof(int));
    
            var dateParameter = date.HasValue ?
                new ObjectParameter("Date", date) :
                new ObjectParameter("Date", typeof(System.DateTime));
    
            var contact_IdParameter = contact_Id.HasValue ?
                new ObjectParameter("Contact_Id", contact_Id) :
                new ObjectParameter("Contact_Id", typeof(int));
    
            var objectiveParameter = objective.HasValue ?
                new ObjectParameter("Objective", objective) :
                new ObjectParameter("Objective", typeof(int));
    
            var time_InParameter = time_In.HasValue ?
                new ObjectParameter("Time_In", time_In) :
                new ObjectParameter("Time_In", typeof(System.TimeSpan));
    
            var time_OutParameter = time_Out.HasValue ?
                new ObjectParameter("Time_Out", time_Out) :
                new ObjectParameter("Time_Out", typeof(System.TimeSpan));
    
            var time_SpentParameter = time_Spent.HasValue ?
                new ObjectParameter("Time_Spent", time_Spent) :
                new ObjectParameter("Time_Spent", typeof(int));
    
            var time_w_MerchandiserParameter = time_w_Merchandiser.HasValue ?
                new ObjectParameter("Time_w_Merchandiser", time_w_Merchandiser) :
                new ObjectParameter("Time_w_Merchandiser", typeof(int));
    
            var collectionParameter = collection.HasValue ?
                new ObjectParameter("Collection", collection) :
                new ObjectParameter("Collection", typeof(int));
    
            var secondary_SalesParameter = secondary_Sales.HasValue ?
                new ObjectParameter("Secondary_Sales", secondary_Sales) :
                new ObjectParameter("Secondary_Sales", typeof(int));
    
            var sales_LPO_ReceivedParameter = sales_LPO_Received.HasValue ?
                new ObjectParameter("Sales_LPO_Received", sales_LPO_Received) :
                new ObjectParameter("Sales_LPO_Received", typeof(int));
    
            var discountParameter = discount.HasValue ?
                new ObjectParameter("Discount", discount) :
                new ObjectParameter("Discount", typeof(int));
    
            var sales_ReturnParameter = sales_Return.HasValue ?
                new ObjectParameter("Sales_Return", sales_Return) :
                new ObjectParameter("Sales_Return", typeof(int));
    
            var remarksParameter = remarks != null ?
                new ObjectParameter("Remarks", remarks) :
                new ObjectParameter("Remarks", typeof(string));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetDSR_Result>("GetDSR", dSR_IdParameter, site_User_IdParameter, dateParameter, contact_IdParameter, objectiveParameter, time_InParameter, time_OutParameter, time_SpentParameter, time_w_MerchandiserParameter, collectionParameter, secondary_SalesParameter, sales_LPO_ReceivedParameter, discountParameter, sales_ReturnParameter, remarksParameter);
        }
    
        public virtual ObjectResult<GetActiveContactCustomerLocation_Result> GetActiveContactCustomerLocation(Nullable<int> user_Id)
        {
            var user_IdParameter = user_Id.HasValue ?
                new ObjectParameter("User_Id", user_Id) :
                new ObjectParameter("User_Id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetActiveContactCustomerLocation_Result>("GetActiveContactCustomerLocation", user_IdParameter);
        }
    
        public virtual int UpdateVisit(Nullable<int> dSR_Id, Nullable<int> customer_Id, string customer_Name, string customer_Name_BL, Nullable<int> location_Id, Nullable<int> contact_Id, string contact_Name, string contact_Name_BL, string department, string department_BL, string mobile, Nullable<int> site_User_Id, Nullable<System.DateTime> date, Nullable<int> objective, Nullable<System.TimeSpan> time_In, Nullable<System.TimeSpan> time_Out, Nullable<int> time_w_Merchandiser, Nullable<int> collection, Nullable<int> secondary_Sales, Nullable<int> sales_LPO_Received, Nullable<int> discount, Nullable<int> sales_Return, string remarks, Nullable<int> updated_By)
        {
            var dSR_IdParameter = dSR_Id.HasValue ?
                new ObjectParameter("DSR_Id", dSR_Id) :
                new ObjectParameter("DSR_Id", typeof(int));
    
            var customer_IdParameter = customer_Id.HasValue ?
                new ObjectParameter("Customer_Id", customer_Id) :
                new ObjectParameter("Customer_Id", typeof(int));
    
            var customer_NameParameter = customer_Name != null ?
                new ObjectParameter("Customer_Name", customer_Name) :
                new ObjectParameter("Customer_Name", typeof(string));
    
            var customer_Name_BLParameter = customer_Name_BL != null ?
                new ObjectParameter("Customer_Name_BL", customer_Name_BL) :
                new ObjectParameter("Customer_Name_BL", typeof(string));
    
            var location_IdParameter = location_Id.HasValue ?
                new ObjectParameter("Location_Id", location_Id) :
                new ObjectParameter("Location_Id", typeof(int));
    
            var contact_IdParameter = contact_Id.HasValue ?
                new ObjectParameter("Contact_Id", contact_Id) :
                new ObjectParameter("Contact_Id", typeof(int));
    
            var contact_NameParameter = contact_Name != null ?
                new ObjectParameter("Contact_Name", contact_Name) :
                new ObjectParameter("Contact_Name", typeof(string));
    
            var contact_Name_BLParameter = contact_Name_BL != null ?
                new ObjectParameter("Contact_Name_BL", contact_Name_BL) :
                new ObjectParameter("Contact_Name_BL", typeof(string));
    
            var departmentParameter = department != null ?
                new ObjectParameter("Department", department) :
                new ObjectParameter("Department", typeof(string));
    
            var department_BLParameter = department_BL != null ?
                new ObjectParameter("Department_BL", department_BL) :
                new ObjectParameter("Department_BL", typeof(string));
    
            var mobileParameter = mobile != null ?
                new ObjectParameter("Mobile", mobile) :
                new ObjectParameter("Mobile", typeof(string));
    
            var site_User_IdParameter = site_User_Id.HasValue ?
                new ObjectParameter("Site_User_Id", site_User_Id) :
                new ObjectParameter("Site_User_Id", typeof(int));
    
            var dateParameter = date.HasValue ?
                new ObjectParameter("Date", date) :
                new ObjectParameter("Date", typeof(System.DateTime));
    
            var objectiveParameter = objective.HasValue ?
                new ObjectParameter("Objective", objective) :
                new ObjectParameter("Objective", typeof(int));
    
            var time_InParameter = time_In.HasValue ?
                new ObjectParameter("Time_In", time_In) :
                new ObjectParameter("Time_In", typeof(System.TimeSpan));
    
            var time_OutParameter = time_Out.HasValue ?
                new ObjectParameter("Time_Out", time_Out) :
                new ObjectParameter("Time_Out", typeof(System.TimeSpan));
    
            var time_w_MerchandiserParameter = time_w_Merchandiser.HasValue ?
                new ObjectParameter("Time_w_Merchandiser", time_w_Merchandiser) :
                new ObjectParameter("Time_w_Merchandiser", typeof(int));
    
            var collectionParameter = collection.HasValue ?
                new ObjectParameter("Collection", collection) :
                new ObjectParameter("Collection", typeof(int));
    
            var secondary_SalesParameter = secondary_Sales.HasValue ?
                new ObjectParameter("Secondary_Sales", secondary_Sales) :
                new ObjectParameter("Secondary_Sales", typeof(int));
    
            var sales_LPO_ReceivedParameter = sales_LPO_Received.HasValue ?
                new ObjectParameter("Sales_LPO_Received", sales_LPO_Received) :
                new ObjectParameter("Sales_LPO_Received", typeof(int));
    
            var discountParameter = discount.HasValue ?
                new ObjectParameter("Discount", discount) :
                new ObjectParameter("Discount", typeof(int));
    
            var sales_ReturnParameter = sales_Return.HasValue ?
                new ObjectParameter("Sales_Return", sales_Return) :
                new ObjectParameter("Sales_Return", typeof(int));
    
            var remarksParameter = remarks != null ?
                new ObjectParameter("Remarks", remarks) :
                new ObjectParameter("Remarks", typeof(string));
    
            var updated_ByParameter = updated_By.HasValue ?
                new ObjectParameter("Updated_By", updated_By) :
                new ObjectParameter("Updated_By", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("UpdateVisit", dSR_IdParameter, customer_IdParameter, customer_NameParameter, customer_Name_BLParameter, location_IdParameter, contact_IdParameter, contact_NameParameter, contact_Name_BLParameter, departmentParameter, department_BLParameter, mobileParameter, site_User_IdParameter, dateParameter, objectiveParameter, time_InParameter, time_OutParameter, time_w_MerchandiserParameter, collectionParameter, secondary_SalesParameter, sales_LPO_ReceivedParameter, discountParameter, sales_ReturnParameter, remarksParameter, updated_ByParameter);
        }
    
        public virtual ObjectResult<GetExecutiveReport_Result> GetExecutiveReport(Nullable<int> month, Nullable<int> year, Nullable<int> executive_Id)
        {
            var monthParameter = month.HasValue ?
                new ObjectParameter("Month", month) :
                new ObjectParameter("Month", typeof(int));
    
            var yearParameter = year.HasValue ?
                new ObjectParameter("Year", year) :
                new ObjectParameter("Year", typeof(int));
    
            var executive_IdParameter = executive_Id.HasValue ?
                new ObjectParameter("Executive_Id", executive_Id) :
                new ObjectParameter("Executive_Id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetExecutiveReport_Result>("GetExecutiveReport", monthParameter, yearParameter, executive_IdParameter);
        }
    
        public virtual ObjectResult<GetReporteesForUserCreation_Result> GetReporteesForUserCreation(Nullable<int> role_Id, Nullable<int> location_Id)
        {
            var role_IdParameter = role_Id.HasValue ?
                new ObjectParameter("Role_Id", role_Id) :
                new ObjectParameter("Role_Id", typeof(int));
    
            var location_IdParameter = location_Id.HasValue ?
                new ObjectParameter("Location_Id", location_Id) :
                new ObjectParameter("Location_Id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetReporteesForUserCreation_Result>("GetReporteesForUserCreation", role_IdParameter, location_IdParameter);
        }
    
        public virtual int InsertUpdateUser(Nullable<int> user_Id, string name, string password, string email, Nullable<int> role_Id, Nullable<int> location_Id, string employee_Code, Nullable<bool> status, string linkedUsers, Nullable<int> language_Id)
        {
            var user_IdParameter = user_Id.HasValue ?
                new ObjectParameter("User_Id", user_Id) :
                new ObjectParameter("User_Id", typeof(int));
    
            var nameParameter = name != null ?
                new ObjectParameter("Name", name) :
                new ObjectParameter("Name", typeof(string));
    
            var passwordParameter = password != null ?
                new ObjectParameter("Password", password) :
                new ObjectParameter("Password", typeof(string));
    
            var emailParameter = email != null ?
                new ObjectParameter("Email", email) :
                new ObjectParameter("Email", typeof(string));
    
            var role_IdParameter = role_Id.HasValue ?
                new ObjectParameter("Role_Id", role_Id) :
                new ObjectParameter("Role_Id", typeof(int));
    
            var location_IdParameter = location_Id.HasValue ?
                new ObjectParameter("Location_Id", location_Id) :
                new ObjectParameter("Location_Id", typeof(int));
    
            var employee_CodeParameter = employee_Code != null ?
                new ObjectParameter("Employee_Code", employee_Code) :
                new ObjectParameter("Employee_Code", typeof(string));
    
            var statusParameter = status.HasValue ?
                new ObjectParameter("Status", status) :
                new ObjectParameter("Status", typeof(bool));
    
            var linkedUsersParameter = linkedUsers != null ?
                new ObjectParameter("LinkedUsers", linkedUsers) :
                new ObjectParameter("LinkedUsers", typeof(string));
    
            var language_IdParameter = language_Id.HasValue ?
                new ObjectParameter("Language_Id", language_Id) :
                new ObjectParameter("Language_Id", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("InsertUpdateUser", user_IdParameter, nameParameter, passwordParameter, emailParameter, role_IdParameter, location_IdParameter, employee_CodeParameter, statusParameter, linkedUsersParameter, language_IdParameter);
        }
    
        public virtual ObjectResult<GetCustomer_Result> GetCustomer(Nullable<int> customer_Id, string customer_Code, string customer_Name, string customer_Name_BL, Nullable<int> business_Type, Nullable<int> customer_Type, Nullable<int> customer_Group, Nullable<int> location_Id, Nullable<bool> key_Account, Nullable<bool> status, Nullable<int> sales_Channel)
        {
            var customer_IdParameter = customer_Id.HasValue ?
                new ObjectParameter("Customer_Id", customer_Id) :
                new ObjectParameter("Customer_Id", typeof(int));
    
            var customer_CodeParameter = customer_Code != null ?
                new ObjectParameter("Customer_Code", customer_Code) :
                new ObjectParameter("Customer_Code", typeof(string));
    
            var customer_NameParameter = customer_Name != null ?
                new ObjectParameter("Customer_Name", customer_Name) :
                new ObjectParameter("Customer_Name", typeof(string));
    
            var customer_Name_BLParameter = customer_Name_BL != null ?
                new ObjectParameter("Customer_Name_BL", customer_Name_BL) :
                new ObjectParameter("Customer_Name_BL", typeof(string));
    
            var business_TypeParameter = business_Type.HasValue ?
                new ObjectParameter("Business_Type", business_Type) :
                new ObjectParameter("Business_Type", typeof(int));
    
            var customer_TypeParameter = customer_Type.HasValue ?
                new ObjectParameter("Customer_Type", customer_Type) :
                new ObjectParameter("Customer_Type", typeof(int));
    
            var customer_GroupParameter = customer_Group.HasValue ?
                new ObjectParameter("Customer_Group", customer_Group) :
                new ObjectParameter("Customer_Group", typeof(int));
    
            var location_IdParameter = location_Id.HasValue ?
                new ObjectParameter("Location_Id", location_Id) :
                new ObjectParameter("Location_Id", typeof(int));
    
            var key_AccountParameter = key_Account.HasValue ?
                new ObjectParameter("Key_Account", key_Account) :
                new ObjectParameter("Key_Account", typeof(bool));
    
            var statusParameter = status.HasValue ?
                new ObjectParameter("Status", status) :
                new ObjectParameter("Status", typeof(bool));
    
            var sales_ChannelParameter = sales_Channel.HasValue ?
                new ObjectParameter("Sales_Channel", sales_Channel) :
                new ObjectParameter("Sales_Channel", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GetCustomer_Result>("GetCustomer", customer_IdParameter, customer_CodeParameter, customer_NameParameter, customer_Name_BLParameter, business_TypeParameter, customer_TypeParameter, customer_GroupParameter, location_IdParameter, key_AccountParameter, statusParameter, sales_ChannelParameter);
        }
    
        public virtual int InsertUpdateCustomer(Nullable<int> customer_Id, string customer_Code, string customer_Name, string customer_Name_BL, Nullable<int> business_Type, Nullable<int> customer_Type, Nullable<int> customer_Group, Nullable<int> location_Id, Nullable<bool> key_Account, Nullable<bool> status, Nullable<int> updated_By, Nullable<int> sales_Channel, ObjectParameter custId)
        {
            var customer_IdParameter = customer_Id.HasValue ?
                new ObjectParameter("Customer_Id", customer_Id) :
                new ObjectParameter("Customer_Id", typeof(int));
    
            var customer_CodeParameter = customer_Code != null ?
                new ObjectParameter("Customer_Code", customer_Code) :
                new ObjectParameter("Customer_Code", typeof(string));
    
            var customer_NameParameter = customer_Name != null ?
                new ObjectParameter("Customer_Name", customer_Name) :
                new ObjectParameter("Customer_Name", typeof(string));
    
            var customer_Name_BLParameter = customer_Name_BL != null ?
                new ObjectParameter("Customer_Name_BL", customer_Name_BL) :
                new ObjectParameter("Customer_Name_BL", typeof(string));
    
            var business_TypeParameter = business_Type.HasValue ?
                new ObjectParameter("Business_Type", business_Type) :
                new ObjectParameter("Business_Type", typeof(int));
    
            var customer_TypeParameter = customer_Type.HasValue ?
                new ObjectParameter("Customer_Type", customer_Type) :
                new ObjectParameter("Customer_Type", typeof(int));
    
            var customer_GroupParameter = customer_Group.HasValue ?
                new ObjectParameter("Customer_Group", customer_Group) :
                new ObjectParameter("Customer_Group", typeof(int));
    
            var location_IdParameter = location_Id.HasValue ?
                new ObjectParameter("Location_Id", location_Id) :
                new ObjectParameter("Location_Id", typeof(int));
    
            var key_AccountParameter = key_Account.HasValue ?
                new ObjectParameter("Key_Account", key_Account) :
                new ObjectParameter("Key_Account", typeof(bool));
    
            var statusParameter = status.HasValue ?
                new ObjectParameter("Status", status) :
                new ObjectParameter("Status", typeof(bool));
    
            var updated_ByParameter = updated_By.HasValue ?
                new ObjectParameter("Updated_By", updated_By) :
                new ObjectParameter("Updated_By", typeof(int));
    
            var sales_ChannelParameter = sales_Channel.HasValue ?
                new ObjectParameter("Sales_Channel", sales_Channel) :
                new ObjectParameter("Sales_Channel", typeof(int));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("InsertUpdateCustomer", customer_IdParameter, customer_CodeParameter, customer_NameParameter, customer_Name_BLParameter, business_TypeParameter, customer_TypeParameter, customer_GroupParameter, location_IdParameter, key_AccountParameter, statusParameter, updated_ByParameter, sales_ChannelParameter, custId);
        }
    }
}
