/// <summary> /// 资产类型详细信息 /// </summary> public void GETLOCATIONMODEL(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { int Id = int.Parse(P1); SZHL_ZCGL_Location model = new SZHL_ZCGL_LocationB().GetEntity(d => d.ID == Id && d.ComId == UserInfo.User.ComId); msg.Result = model; }
/// <summary> /// 所有资产状态列表,并展示资产数量 /// </summary> public void GETZCGLSTATUSLISTBYLIFECYCLEWITHNUM(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.TypeID='" + P1 + "' "; } if (!string.IsNullOrEmpty(P2)) { where += " and z.ID in ( select ZCGLID from SZHL_ZCGL_LifeCycle where TypeID= '" + P2 + "' and IsDel=0 ) "; } string location = context.Request["location"] ?? ""; if (!string.IsNullOrEmpty(location)) { where += string.Format(" And z.LocationID='{0}' ", location); } string tmpTable = "#StatusData" + DateTime.Now.ToString("yyMMddhhmmss"); string statusdata = context.Request["statusdata"] ?? ""; List <ExtentionData> ExDataList = JsonConvert.DeserializeObject <List <ExtentionData> >(statusdata); string tmpS = " create table " + tmpTable + "(ID int NOT NULL, TypeName varchar(50) NOT NULL) "; foreach (ExtentionData e in ExDataList) { tmpS += " insert into " + tmpTable + " values ('" + e.ID + "','" + e.TypeName + "')"; } tmpS += " select s.*, (select count(0) from dbo.SZHL_ZCGL z where " + where + " and z.Status=s.ID ) as ZCNum from " + tmpTable + " s where (select count(0) from dbo.SZHL_ZCGL z where " + where + " and z.Status=s.ID)>0 "; tmpS += " drop table " + tmpTable; DataTable dt = new SZHL_ZCGL_LocationB().GetDTByCommand(tmpS); msg.Result = dt; }
/// <summary> /// 资产类型分页列表 /// </summary> public void GETZCGLLOCATIONLIST_PAGE(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { string strWhere = " cc.ComId=" + UserInfo.User.ComId; //strWhere += string.Format(" And cc.CRUser='******' ", UserInfo.User.UserName); if (P1 != "") { strWhere += string.Format(" And cc.Title like '%{0}%'", P1); } string bc = context.Request["branchcode"] ?? ""; if (bc != "") { strWhere += string.Format(" And cc.BranchCode = '{0}'", bc); } 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_LocationB().GetDataPager(" SZHL_ZCGL_LOCATION cc left join JH_Auth_Branch b on cc.BranchCode=b.DeptCode", "cc.* , b.DeptName", pagecount, page, " cc.DisplayOrder", strWhere, ref total); msg.Result = dt; msg.Result1 = total; }
/// <summary> /// 所有资产类型列表 /// </summary> public void GETZCGLLOCATIONLIST(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_LocationB().GetDTByCommand("select * from dbo.SZHL_ZCGL_LOCATION where IsDel=0 and ComId=" + UserInfo.User.ComId + " order by DisplayOrder"); msg.Result = dt; }
/// <summary> /// 删除资产类型 /// </summary> public void DELZCGLLOCATION(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_Location model = new SZHL_ZCGL_LocationB().GetEntity(d => d.ID == Id && d.ComId == UserInfo.User.ComId); model.IsDel = ss; new SZHL_ZCGL_LocationB().Update(model); }
/// <summary> /// 添加资产类型 /// </summary> public void ADDLOCATION(HttpContext context, Msg_Result msg, string P1, string P2, JH_Auth_UserB.UserInfo UserInfo) { SZHL_ZCGL_Location t = JsonConvert.DeserializeObject <SZHL_ZCGL_Location>(P1); if (string.IsNullOrEmpty(t.Title)) { msg.ErrorMsg = "场地名称不能为空!"; } if (t.BranchCode == null || t.BranchCode <= 0) { msg.ErrorMsg = "公司不能为空!"; } if (string.IsNullOrEmpty(msg.ErrorMsg)) { if (t.ID == 0) { var t1 = new SZHL_ZCGL_LocationB().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_LocationB().Insert(t); msg.Result = t; } } else { var hys1 = new SZHL_ZCGL_LocationB().GetEntity(p => p.ComId == UserInfo.User.ComId && p.Title == t.Title && p.ID != t.ID); if (hys1 != null) { msg.ErrorMsg = "系统已经存在此类型名称"; } else { new SZHL_ZCGL_LocationB().Update(t); msg.Result = t; } } } }
/// <summary> /// 所有资产类型列表,并展示资产数量 /// </summary> public void GETZCGLLOCATIONLISTWITHNUM(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.TypeID='" + P1 + "' "; } if (!string.IsNullOrEmpty(P2)) { where += " and z.BranchCode='" + P2 + "' "; } string status = context.Request["status"] ?? ""; if (!string.IsNullOrEmpty(status)) { where += string.Format(" And z.Status='{0}' ", status); } DataTable dt = new SZHL_ZCGL_LocationB().GetDTByCommand("select *,(select COUNT(0) from dbo.SZHL_ZCGL z where " + where + " and z.LocationID=l.ID) as ZCNum from dbo.SZHL_ZCGL_LOCATION l where IsDel=0 and BranchCode='" + P2 + "' and ComId=" + UserInfo.User.ComId + " and (select COUNT(0) from dbo.SZHL_ZCGL z where " + where + " and z.LocationID=l.ID)>0 order by DisplayOrder"); msg.Result = dt; }