using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using BusinessLogic;
using BusinessObject;
using BusinessObject.Common;
using ERP.Utilities;
using ERPService;
namespace ERPHotel.Models
{
public class UserLevelModel
{
#region Properties
/// <summary>
/// Current PK
/// </summary>
private int USERLEVELPK
{
get;
set;
}
/// <summary>
/// To maintain the PageIndex in viewstate
/// </summary>
private string PageIndex
{
get;
set;
}
/// <summary>
/// To maintain the total pages in viewstate
/// </summary>
private int TotalPages
{
get;
set;
}
/// <summary>
/// To maintain the SortExpression or sort By in viewstate
/// </summary>
private string SortBy
{
get;
set;
}
/// <summary>
/// To maintain the SortExpression or then By in viewstate
/// </summary>
private string ThenBy
{
get;
set;
}
/// <summary>
/// To maintain the Sort Direction in viewstate
/// </summary>
private string SortDirection
{
get;
set;
}
/// <summary>
/// To maintain the LastModifiedTime in viewstate
/// </summary>
private DateTime LastModifiedTime
{
get;
set;
}
/// <summary>
/// Entry State for managing display status
/// </summary>
private EntryStatus EntryStatus
{
get;
set;
}
/// <summary>
/// Page Size
/// </summary>
private int PageSize
{
get;
set;
}
#endregion
[DisplayName("Id")]
public int ugrp_id { get; set; }
[DisplayName("Description :")]
public string ugrp_name { get; set; }
[DisplayName("Description :")]
public string ugrp_descr { get; set; }
[DisplayName("Designation :")]
public string ugrp_desc { get; set; }
[DisplayName("Is Admin Group :")]
public bool ugrp_admin { get; set; }
[DisplayName("User Management >> User Level")]
public bool Breadcrumb { get; set; }
private ServiceUtility serviceUtilityObj;
private static user_groups user_groupsObj;
private DataSet dsuser_groups;
private DataTable dtuser_groups;
#region Get Field Values
/// <summary>
/// Gets the data to bind/assign for the controls(inputs, grids, dropdowns etc.)
/// pass string.empty to get all field values
/// Assign it to the page level variables
/// </summary>
public object GetFieldValues(ControlsEnum type)
{
try
{
Object retObject;
retObject = null;
PageSize = 20;
switch (type)
{
case ControlsEnum.USERLEVEL:
user_groupsObj = new user_groups();
user_groupsObj.ugrp_id = USERLEVELPK;
serviceUtilityObj = new ServiceUtility();
serviceUtilityObj.CurrentPage = PageIndex == null ? 1 : Convert.ToInt32(PageIndex);
serviceUtilityObj.PageSize = PageSize;
serviceUtilityObj.SortBy = SortBy = SortBy == null ? Resources.DataFieldRes.USERLEVELPK : SortBy;
serviceUtilityObj.ThenBy = ThenBy = ThenBy == null ? Resources.DataFieldRes.USERLEVELPK : ThenBy;
serviceUtilityObj.SortDirection = SortDirection = SortDirection == null ? Resources.Report.SortDescending : SortDirection;
dsuser_groups = user_groupsBL.Getuser_groupsList(user_groupsObj, serviceUtilityObj);
retObject = dsuser_groups;
serviceUtilityObj.TotalRecords = int.Parse(dsuser_groups.Tables[0].Rows[0][0].ToString());
TotalPages = serviceUtilityObj.TotalRecords == 0 ? 1 : (serviceUtilityObj.TotalRecords <= serviceUtilityObj.PageSize) ? 1 :
(serviceUtilityObj.TotalRecords % serviceUtilityObj.PageSize) == 0 ? (serviceUtilityObj.TotalRecords / serviceUtilityObj.PageSize) :
(serviceUtilityObj.TotalRecords / serviceUtilityObj.PageSize) + 1;
break;
case ControlsEnum.USERLEVELDETAILS:
dtuser_groups = user_groupsBL.Getuser_groups(USERLEVELPK);
if (dtuser_groups.Rows.Count > 0)
{
user_groupsObj = new user_groups();
user_groupsObj.ugrp_id = Convert.ToInt32(dtuser_groups.Rows[0][user_groups.F_ugrp_id].ToString());
user_groupsObj.ugrp_name = dtuser_groups.Rows[0][user_groups.F_ugrp_name].ToString();
user_groupsObj.ugrp_desc = dtuser_groups.Rows[0][user_groups.F_ugrp_desc].ToString();
user_groupsObj.ugrp_admin = Convert.ToBoolean(dtuser_groups.Rows[0][user_groups.F_ugrp_admin]);
}
retObject = user_groupsObj;
break;
case ControlsEnum.USERLEVELSEARCH:
user_groupsObj = new user_groups();
dtuser_groups = user_groupsBL.Getuser_groups(USERLEVELPK);
retObject = dtuser_groups;
break;
}
return retObject;
}
catch (Exception ex)
{
throw ex;
}
finally
{
}
}
#endregion
#region Enum
/// <summary>
///Page Controls Enum
/// </summary>
public enum ControlsEnum
{
USERLEVEL,
USERLEVELLIST,
USERLEVELDETAILS,
USERLEVELSEARCH
}
#endregion
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using BusinessLogic;
using BusinessObject;
using BusinessObject.Common;
using ERP.Utilities;
using ERPService;
namespace ERPHotel.Models
{
public class UserLevelModel
{
#region Properties
/// <summary>
/// Current PK
/// </summary>
private int USERLEVELPK
{
get;
set;
}
/// <summary>
/// To maintain the PageIndex in viewstate
/// </summary>
private string PageIndex
{
get;
set;
}
/// <summary>
/// To maintain the total pages in viewstate
/// </summary>
private int TotalPages
{
get;
set;
}
/// <summary>
/// To maintain the SortExpression or sort By in viewstate
/// </summary>
private string SortBy
{
get;
set;
}
/// <summary>
/// To maintain the SortExpression or then By in viewstate
/// </summary>
private string ThenBy
{
get;
set;
}
/// <summary>
/// To maintain the Sort Direction in viewstate
/// </summary>
private string SortDirection
{
get;
set;
}
/// <summary>
/// To maintain the LastModifiedTime in viewstate
/// </summary>
private DateTime LastModifiedTime
{
get;
set;
}
/// <summary>
/// Entry State for managing display status
/// </summary>
private EntryStatus EntryStatus
{
get;
set;
}
/// <summary>
/// Page Size
/// </summary>
private int PageSize
{
get;
set;
}
#endregion
[DisplayName("Id")]
public int ugrp_id { get; set; }
[DisplayName("Description :")]
public string ugrp_name { get; set; }
[DisplayName("Description :")]
public string ugrp_descr { get; set; }
[DisplayName("Designation :")]
public string ugrp_desc { get; set; }
[DisplayName("Is Admin Group :")]
public bool ugrp_admin { get; set; }
[DisplayName("User Management >> User Level")]
public bool Breadcrumb { get; set; }
private ServiceUtility serviceUtilityObj;
private static user_groups user_groupsObj;
private DataSet dsuser_groups;
private DataTable dtuser_groups;
#region Get Field Values
/// <summary>
/// Gets the data to bind/assign for the controls(inputs, grids, dropdowns etc.)
/// pass string.empty to get all field values
/// Assign it to the page level variables
/// </summary>
public object GetFieldValues(ControlsEnum type)
{
try
{
Object retObject;
retObject = null;
PageSize = 20;
switch (type)
{
case ControlsEnum.USERLEVEL:
user_groupsObj = new user_groups();
user_groupsObj.ugrp_id = USERLEVELPK;
serviceUtilityObj = new ServiceUtility();
serviceUtilityObj.CurrentPage = PageIndex == null ? 1 : Convert.ToInt32(PageIndex);
serviceUtilityObj.PageSize = PageSize;
serviceUtilityObj.SortBy = SortBy = SortBy == null ? Resources.DataFieldRes.USERLEVELPK : SortBy;
serviceUtilityObj.ThenBy = ThenBy = ThenBy == null ? Resources.DataFieldRes.USERLEVELPK : ThenBy;
serviceUtilityObj.SortDirection = SortDirection = SortDirection == null ? Resources.Report.SortDescending : SortDirection;
dsuser_groups = user_groupsBL.Getuser_groupsList(user_groupsObj, serviceUtilityObj);
retObject = dsuser_groups;
serviceUtilityObj.TotalRecords = int.Parse(dsuser_groups.Tables[0].Rows[0][0].ToString());
TotalPages = serviceUtilityObj.TotalRecords == 0 ? 1 : (serviceUtilityObj.TotalRecords <= serviceUtilityObj.PageSize) ? 1 :
(serviceUtilityObj.TotalRecords % serviceUtilityObj.PageSize) == 0 ? (serviceUtilityObj.TotalRecords / serviceUtilityObj.PageSize) :
(serviceUtilityObj.TotalRecords / serviceUtilityObj.PageSize) + 1;
break;
case ControlsEnum.USERLEVELDETAILS:
dtuser_groups = user_groupsBL.Getuser_groups(USERLEVELPK);
if (dtuser_groups.Rows.Count > 0)
{
user_groupsObj = new user_groups();
user_groupsObj.ugrp_id = Convert.ToInt32(dtuser_groups.Rows[0][user_groups.F_ugrp_id].ToString());
user_groupsObj.ugrp_name = dtuser_groups.Rows[0][user_groups.F_ugrp_name].ToString();
user_groupsObj.ugrp_desc = dtuser_groups.Rows[0][user_groups.F_ugrp_desc].ToString();
user_groupsObj.ugrp_admin = Convert.ToBoolean(dtuser_groups.Rows[0][user_groups.F_ugrp_admin]);
}
retObject = user_groupsObj;
break;
case ControlsEnum.USERLEVELSEARCH:
user_groupsObj = new user_groups();
dtuser_groups = user_groupsBL.Getuser_groups(USERLEVELPK);
retObject = dtuser_groups;
break;
}
return retObject;
}
catch (Exception ex)
{
throw ex;
}
finally
{
}
}
#endregion
#region Enum
/// <summary>
///Page Controls Enum
/// </summary>
public enum ControlsEnum
{
USERLEVEL,
USERLEVELLIST,
USERLEVELDETAILS,
USERLEVELSEARCH
}
#endregion
}
}
No comments:
Post a Comment