/// <summary> /// 资产类型详细信息 /// </summary> public void GETTYPEMODEL(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { int Id = int.Parse(P1); SZHL_ZCGL_Type model = new SZHL_ZCGL_TypeB().GetEntity(d => d.ID == Id && d.ComId == UserInfo.User.ComId); msg.Result = model; }
/// <summary> /// 所有资产类型列表 /// </summary> public void GETZCGLTYPELIST(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { //var list = new SZHL_ZCGL_TypeB().GetEntities(p => p.IsDel == 0); DataTable dt = new SZHL_ZCGL_TypeB().GetDTByCommand("select * from dbo.SZHL_ZCGL_Type where IsDel=0 and ComId=" + UserInfo.User.ComId + " order by DisplayOrder"); msg.Result = dt; }
/// <summary> /// 删除资产类型 /// </summary> public void DELZCGLTYPE(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { int Id = int.Parse(P1); int ss = int.Parse(P2); SZHL_ZCGL_Type model = new SZHL_ZCGL_TypeB().GetEntity(d => d.ID == Id && d.ComId == UserInfo.User.ComId); model.IsDel = ss; new SZHL_ZCGL_TypeB().Update(model); }
public void GETTYPEMODELBYZCGLID(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { int ZCGLId = int.Parse(P1); string strWhere = " t.IsDel=0 and z.ID=" + ZCGLId; string colNme = @"t.* "; string tableName = string.Format(@" SZHL_ZCGL_Type t left join SZHL_ZCGL z on z.TypeID=t.ID and z.IsDel=0 "); string strSql = string.Format("Select {0} From {1} where {2} ", colNme, tableName, strWhere); DataTable dt = new SZHL_ZCGL_TypeB().GetDTByCommand(strSql); msg.Result = dt; }
/// <summary> /// 根据生命周期获取所有资产类型列表,并展示资产数量 /// </summary> public void GETZCGLTYPELISTBYLIFECYCLEWITHNUM(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { string where = " z.IsDel=0 "; if (!string.IsNullOrEmpty(P1)) { where += " and z.ID in ( select ZCGLID from SZHL_ZCGL_LifeCycle where TypeID= '" + P1 + "' and IsDel=0 ) "; } string status = context.Request["status"] ?? ""; if (!string.IsNullOrEmpty(status)) { where += string.Format(" And z.Status='{0}' ", status); } DataTable dt = new SZHL_ZCGL_TypeB().GetDTByCommand("select *,(select COUNT(0) from dbo.SZHL_ZCGL z where " + where + " and z.TypeID=t.ID) as ZCNum from dbo.SZHL_ZCGL_Type t where IsDel=0 and ComId=" + UserInfo.User.ComId + " and (select COUNT(0) from dbo.SZHL_ZCGL z where " + where + " and z.TypeID=t.ID)>0 order by DisplayOrder"); msg.Result = dt; }
/// <summary> /// 添加资产类型 /// </summary> public void ADDTYPE(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { SZHL_ZCGL_Type t = JsonConvert.DeserializeObject <SZHL_ZCGL_Type>(P1); if (string.IsNullOrEmpty(t.Title)) { msg.ErrorMsg = "类型名称不能为空!"; } if (string.IsNullOrEmpty(msg.ErrorMsg)) { if (t.ID == 0) { var t1 = new SZHL_ZCGL_TypeB().GetEntity(p => p.ComId == UserInfo.User.ComId && p.Title == t.Title); if (t1 != null) { msg.ErrorMsg = "系统已经存在此类型名称!"; } else { t.CRDate = DateTime.Now; t.CRUser = UserInfo.User.UserName; t.ComId = Convert.ToInt16(UserInfo.User.ComId); t.IsDel = 0; new SZHL_ZCGL_TypeB().Insert(t); msg.Result = t; } } else { var hys1 = new SZHL_ZCGL_TypeB().GetEntity(p => p.ComId == UserInfo.User.ComId && p.Title == t.Title && p.ID != t.ID); if (hys1 != null) { msg.ErrorMsg = "系统已经存在此类型名称"; } else { new SZHL_ZCGL_TypeB().Update(t); msg.Result = t; } } } }
/// <summary> /// 资产类型分页列表 /// </summary> public void GETZCGLTYPELIST_PAGE(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { string strWhere = " cc.ComId=" + UserInfo.User.ComId; if (P1 != "") { strWhere += string.Format(" And cc.Title like '%{0}%'", P1); } int page = 0; int pagecount = 10; int.TryParse(context.Request["p"] ?? "1", out page); int.TryParse(context.Request["pagecount"] ?? "10", out pagecount);//页数 page = page == 0 ? 1 : page; int total = 0; DataTable dt = new SZHL_ZCGL_TypeB().GetDataPager(" SZHL_ZCGL_Type cc", "cc.*", pagecount, page, " cc.DisplayOrder", strWhere, ref total); msg.Result = dt; msg.Result1 = total; }