using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.Mvc;
using DSWeb.SoftMng.BLL;
using DSWeb.SoftMng.DBUtility;
using DSWeb.SoftMng.Model;
using DSWeb.SoftMng.Filter;
using System.Text;
using DSWeb.MvcShipping.Helper;
using System.Web.Script.Serialization;
using HcUtility.Comm;
using System.Data;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.Areas.RptMng.Comm;
// ReSharper disable once CheckNamespace
namespace DSWeb.SoftMng.Controllers
{
public class HomeController : Controller
{
#region View
///
/// 首页
///
///
public ActionResult Index()
{
ViewData["Notice"] = Json(new op_NoticeBLL().GetModelList(0, 15, "", "CreateTime desc")).Data;
return View();
}
#endregion
#region Handler
///
/// 获取公告详情
///
///
///
public JsonResult GetNoticeDetial(string id)
{
op_NoticeBLL bll = new op_NoticeBLL();
var model = bll.GetModel(id);
return Json(model);
}
public JsonResult GetTopNoticeDetial()
{
op_NoticeBLL bll = new op_NoticeBLL();
var list = bll.GetModelList("CreateTime = (select max(CreateTime) from [op_Notice]) AND GID NOT IN (SELECT NoticeID FROM NOTICEUSERRELATION WHERE USERID='" + Session["USERID"] + "')");
return Json(list);
}
public JsonResult SetNoticeUserRelation(string id)
{
NoticeUserRelationBLL nbll = new NoticeUserRelationBLL();
NoticeUserRelation model = new NoticeUserRelation();
model.GID = Guid.NewGuid().ToString();
model.NoticeID = id;
model.UserID = Session["USERID"].ToString();
var result = nbll.Add(model) > 0;
return Json(result);
}
///
/// 主页面任务 待办工作 (待办任务 待办项目)
///
///
public ContentResult GetTaskList()
{
var dbparams = new List();
var parampsOrgCode = new CustomDbParamter();
parampsOrgCode.ParameterName = "@userid";
parampsOrgCode.DbType = DbType.String;
parampsOrgCode.Direction = ParameterDirection.Input;
parampsOrgCode.Value = Session["USERID"].ToString();
dbparams.Add(parampsOrgCode);
var parampsOrgCode2 = new CustomDbParamter();
parampsOrgCode2.ParameterName = "@username";
parampsOrgCode2.DbType = DbType.String;
parampsOrgCode2.Direction = ParameterDirection.Input;
parampsOrgCode2.Value = Session["SHOWNAME"].ToString();
dbparams.Add(parampsOrgCode2);
var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet("P_TaskList", dbparams, "Result_Set");
var json = RptHelper.GetRptBsJsonResult(0, 10000, dbRptResult, "Result_Set", false);
return new ContentResult() { Content = json };
}
///
/// 获取关于
///
///
public ContentResult About()
{
var jsonRespose = new JsonResponse { Success = false, Message = "删除失败" };
var softobj = DbHelperSQL.GetObject("select max([版本号]) FROM [t_sys_soft] ");
sys_secCompanyBLL bll = new sys_secCompanyBLL();
var CompanySecretKey = bll.GetModelList("").FirstOrDefault().CompanySecretKey;
var modelstr = Common.Common.string_Decrypt(CompanySecretKey, "Dw9pVb9r");
var model = new JavaScriptSerializer().Deserialize(modelstr);
jsonRespose = new JsonResponse { Success = true, Message = softobj.ToString()+"|"+model.ModHistory+"|"+model.Times };
return new ContentResult { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
}
}