using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.UI;
using BusinessLogic;
using BusinessObject;
using ERPHotel.Models;
namespace ERPHotel.Controllers
{
public class UserLevelController : Controller
{
private ActionsEnum commonActions;
//
// GET: /UserLevel/
public ActionResult UserLevel(UserLevelModel model)
{
DataSet ds =(DataSet)model.GetFieldValues(UserLevelModel.ControlsEnum.USERLEVEL);
ViewBag.UserLevelList = ds.Tables[1];
ViewBag.message = @"<script type='text/javascript' language='javascript'>$(document).ready(function(){ShowListing(1);});</script>";
return View();
}
[HttpPost]
public ActionResult UserLevel(ERPHotel.Models.UserLevelModel model, string Command, FormCollection frmCollection)
{
var radio = frmCollection.GetValue("SelectOne");
int result = 0;
user_groups objuser_groups = new user_groups();
commonActions = (ActionsEnum)(Enum.Parse(typeof(ActionsEnum), Command));
switch (commonActions)
{
case ActionsEnum.NEW:
break;
case ActionsEnum.SAVE:
if (model != null)
{
objuser_groups.ugrp_admin = model.ugrp_admin;
objuser_groups.ugrp_desc = model.ugrp_desc;
objuser_groups.ugrp_id = model.ugrp_id;
objuser_groups.ugrp_name = model.ugrp_descr;
result = user_groupsBL.Saveuser_groups(objuser_groups, 1);
if (result > 0)
{
DataSet ds = (DataSet)model.GetFieldValues(UserLevelModel.ControlsEnum.USERLEVEL);
ViewBag.UserLevelList = ds.Tables[1];
}
}
break;
case ActionsEnum.DELETE:
break;
case ActionsEnum.CANCEL:
break;
case ActionsEnum.VIEW:
break;
case ActionsEnum.EDIT:
if (model != null)
{
DataTable dtuser_groups = user_groupsBL.Getuser_groups(Convert.ToInt32(radio.AttemptedValue));
if (dtuser_groups.Rows.Count > 0)
{
objuser_groups = new user_groups();
objuser_groups.ugrp_id =Convert.ToInt32(dtuser_groups.Rows[0][user_groups.F_ugrp_id].ToString());
objuser_groups.ugrp_name = dtuser_groups.Rows[0][user_groups.F_ugrp_name].ToString();
objuser_groups.ugrp_desc = dtuser_groups.Rows[0][user_groups.F_ugrp_desc].ToString();
objuser_groups.ugrp_admin = Convert.ToBoolean(dtuser_groups.Rows[0][user_groups.F_ugrp_admin]);
model.ugrp_admin = objuser_groups.ugrp_admin;
model.ugrp_desc = objuser_groups.ugrp_desc;
model.ugrp_id = objuser_groups.ugrp_id;
model.ugrp_descr = objuser_groups.ugrp_name;
var ugrp_descr = frmCollection.GetValue("ugrp_descr");
}
ViewBag.message = @"<script type='text/javascript' language='javascript'>$(document).ready(function(){ShowListing();});</script>";
}
break;
}
return View(model);
}
}
}
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.UI;
using BusinessLogic;
using BusinessObject;
using ERPHotel.Models;
namespace ERPHotel.Controllers
{
public class UserLevelController : Controller
{
private ActionsEnum commonActions;
//
// GET: /UserLevel/
public ActionResult UserLevel(UserLevelModel model)
{
DataSet ds =(DataSet)model.GetFieldValues(UserLevelModel.ControlsEnum.USERLEVEL);
ViewBag.UserLevelList = ds.Tables[1];
ViewBag.message = @"<script type='text/javascript' language='javascript'>$(document).ready(function(){ShowListing(1);});</script>";
return View();
}
[HttpPost]
public ActionResult UserLevel(ERPHotel.Models.UserLevelModel model, string Command, FormCollection frmCollection)
{
var radio = frmCollection.GetValue("SelectOne");
int result = 0;
user_groups objuser_groups = new user_groups();
commonActions = (ActionsEnum)(Enum.Parse(typeof(ActionsEnum), Command));
switch (commonActions)
{
case ActionsEnum.NEW:
break;
case ActionsEnum.SAVE:
if (model != null)
{
objuser_groups.ugrp_admin = model.ugrp_admin;
objuser_groups.ugrp_desc = model.ugrp_desc;
objuser_groups.ugrp_id = model.ugrp_id;
objuser_groups.ugrp_name = model.ugrp_descr;
result = user_groupsBL.Saveuser_groups(objuser_groups, 1);
if (result > 0)
{
DataSet ds = (DataSet)model.GetFieldValues(UserLevelModel.ControlsEnum.USERLEVEL);
ViewBag.UserLevelList = ds.Tables[1];
}
}
break;
case ActionsEnum.DELETE:
break;
case ActionsEnum.CANCEL:
break;
case ActionsEnum.VIEW:
break;
case ActionsEnum.EDIT:
if (model != null)
{
DataTable dtuser_groups = user_groupsBL.Getuser_groups(Convert.ToInt32(radio.AttemptedValue));
if (dtuser_groups.Rows.Count > 0)
{
objuser_groups = new user_groups();
objuser_groups.ugrp_id =Convert.ToInt32(dtuser_groups.Rows[0][user_groups.F_ugrp_id].ToString());
objuser_groups.ugrp_name = dtuser_groups.Rows[0][user_groups.F_ugrp_name].ToString();
objuser_groups.ugrp_desc = dtuser_groups.Rows[0][user_groups.F_ugrp_desc].ToString();
objuser_groups.ugrp_admin = Convert.ToBoolean(dtuser_groups.Rows[0][user_groups.F_ugrp_admin]);
model.ugrp_admin = objuser_groups.ugrp_admin;
model.ugrp_desc = objuser_groups.ugrp_desc;
model.ugrp_id = objuser_groups.ugrp_id;
model.ugrp_descr = objuser_groups.ugrp_name;
var ugrp_descr = frmCollection.GetValue("ugrp_descr");
}
ViewBag.message = @"<script type='text/javascript' language='javascript'>$(document).ready(function(){ShowListing();});</script>";
}
break;
}
return View(model);
}
}
}
No comments:
Post a Comment