| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 供应商列表删除 |
| | | /// </summary> |
| | | /// <param name="HItemID">删除列的ID</param> |
| | | /// <param name="User">当前登录用户</param> |
| | | /// <param name="ModRightNameDelete"></param> |
| | | /// <returns></returns> |
| | | [Route("Gy_Supplier/Delete_Json")] |
| | | [HttpGet] |
| | | public object Delete_Json(long HItemID, string User, string ModRightNameDelete) |
| | | { |
| | | DAL.ClsGy_Supplier_Ctl oGroup = new DAL.ClsGy_Supplier_Ctl(); |
| | | DAL.ClsGy_Supplier_View oGroupHlp = new DAL.ClsGy_Supplier_View(); |
| | | try |
| | | { |
| | | if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, true, User)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有删除权限"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oGroupHlp.GetInfoByID(HItemID)) |
| | | { |
| | | if (oGroup.HavChildCodes(HItemID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此项目存在子项目,不能删除!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //删除前判断是否 已使用 20141020 |
| | | if (oGroupHlp.omodel.HUseFlag != "未使用") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此项目已使用或者未检测,不能删除!请重新检测再删除!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | // |
| | | if (oGroup.DeleteByID(HItemID)) |
| | | { |
| | | //写入日志 |
| | | ClsPub.Add_Log("", "删除项目,代码:" + oGroupHlp.omodel.HNumber + ",名称:" + oGroupHlp.omodel.HName, ClsPub.CurUserName); |
| | | //更新上级为 末级 |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "删除失败"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //ds = oCN.RunProcReturn("delete from Gy_Department where HItemID = " + HItemID, "Gy_Department"); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | // |
| | | } |
| | | } |