/// <summary> /// 编辑区域 /// </summary> public bool EditOrganization(sys_organization_location location, List <sys_organization_location_workhours> hoursList, long userId) { if (OrganizationManage(location, userId)) { OrganizationHours(location.id, hoursList, userId); } else { return(false); } return(true); }
/// <summary> /// 新增区域 /// </summary> public bool AddOrganization(sys_organization_location location, long userId) { if (OrganizationManage(location, userId)) { OrganizationHours(location.id, null, userId); } else { return(false); } return(true); }
protected void Page_Load(object sender, EventArgs e) { long id = 0; if (!string.IsNullOrEmpty(Request.QueryString["id"]) && long.TryParse(Request.QueryString["id"], out id)) { location = locaBll.GetOrganization(id); } if (location != null) { hoursList = locaBll.GetWorkHourList(location.id); isAdd = false; } }
/// <summary> /// 区域管理 /// </summary> public bool OrganizationManage(sys_organization_location location, long user_id) { sys_organization_location_dal solDal = new sys_organization_location_dal(); var defaultLoca = GetDefaultOrganization(); if (location.is_default == 1) { if (defaultLoca != null && defaultLoca.id != location.id) { defaultLoca.is_default = 0; OrganizationManage(defaultLoca, user_id); } } else { if (defaultLoca == null) { return(false); } } if (location.id == 0) { location.id = solDal.GetNextIdCom(); location.create_time = location.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); location.create_user_id = location.update_user_id = user_id; solDal.Insert(location); } else { var oldLocaton = GetOrganization(location.id); if (oldLocaton == null) { return(false); } location.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); location.update_user_id = user_id; solDal.Update(location); } return(true); }