/// <summary> /// 更新单位 /// </summary> /// <param name="Workunit"></param> public static void UpdateWorkUnit(WorkUnit Workunit) { string strWhere = Tables.base_work_unit.CODE + oleDb.EuqalTo( ) + "'" + Workunit.Code + "'"; if (BindEntity <BASE_WORK_UNIT> .CreateInstanceDAL(oleDb).Exists(strWhere)) { try { BASE_WORK_UNIT base_work_unit = new BASE_WORK_UNIT( ); base_work_unit.CODE = Workunit.Code; base_work_unit.NAME = Workunit.Name; base_work_unit.PY_CODE = Workunit.PyCode; base_work_unit.WB_CODE = Workunit.WbCode; BindEntity <BASE_WORK_UNIT> .CreateInstanceDAL(oleDb).Update(strWhere, Tables.base_work_unit.NAME + oleDb.EuqalTo( ) + "'" + Workunit.Name + "'", Tables.base_work_unit.PY_CODE + oleDb.EuqalTo( ) + "'" + Workunit.PyCode + "'", Tables.base_work_unit.WB_CODE + oleDb.EuqalTo( ) + "'" + Workunit.WbCode + "'"); } catch (Exception err) { throw err; } } else { throw new Exception("记录不存在!"); } }
/// <summary> /// 增加单位 /// </summary> /// <param name="Workunit"></param> public static void AddWorkUnit(WorkUnit Workunit) { string strWhere = Tables.base_work_unit.CODE + oleDb.EuqalTo() + "'" + Workunit.Code + "'"; if (BindEntity <BASE_WORK_UNIT> .CreateInstanceDAL(oleDb).Exists(strWhere)) { throw new Exception("代码已经存在!"); } try { BASE_WORK_UNIT base_work_unit = new BASE_WORK_UNIT( ); base_work_unit.CODE = Workunit.Code; base_work_unit.NAME = Workunit.Name; base_work_unit.PY_CODE = Workunit.PyCode; base_work_unit.WB_CODE = Workunit.WbCode; BindEntity <BASE_WORK_UNIT> .CreateInstanceDAL(oleDb).Add(new string[] { Tables.base_work_unit.CODE, Tables.base_work_unit.NAME, Tables.base_work_unit.PY_CODE, Tables.base_work_unit.WB_CODE }, new string[] { "'" + Workunit.Code + "'", "'" + Workunit.Name + "'", "'" + Workunit.PyCode + "'", "'" + Workunit.WbCode + "'" }, new bool[] { false, false, false, false }); } catch (Exception err) { throw err; } }