/// <summary> /// 读取人员隶属组 /// </summary> /// <param name="employeeId"></param> /// <returns></returns> public DataTable get_Employee_GetGroups(int employeeId) { string strWhere_1 = Tables.base_user.EMPLOYEE_ID + OleDB.EuqalTo( ) + employeeId.ToString( ); string childtable_1 = OleDB.ChildTable(Tables.BASE_USER, "", strWhere_1, Tables.base_user.USER_ID); string strWhere_2 = Tables.base_group_user.USER_ID + OleDB.In( ) + childtable_1; string childtable_2 = OleDB.ChildTable(Tables.BASE_GROUP_USER, "", strWhere_2, Tables.base_group_user.GROUP_ID); string strWhere_3 = Tables.base_group.GROUP_ID + OleDB.In( ) + childtable_2; string strsql = OleDB.Table(Tables.BASE_GROUP, "", strWhere_3, Tables.base_group.GROUP_ID, Tables.base_group.NAME); //string sql = "select group_id,name from base_group where group_id in ( select group_id from base_group_user where user_id in (select user_id from base_user where employee_id=" + employeeId + "))"; return(GetDataTable(strsql)); }
/// <summary> /// 上传发票信息 /// </summary> public void UploadDataWithInvoiceInfo() { if (_oleDb == null) { ConnectToRemoteDB( ); } DataTable tbInvoice = MSAccessDb.GetDataTable("select * from mz_invoice where upload_flag=0 and employee_id=" + _employeeId); int invoiceCount = tbInvoice.Rows.Count; if (invoiceCount == 0) { if (UpLoadingEvent != null) { UpLoadingEvent("没有需要上传的发票使用信息!\r\n"); } return; } if (UpLoadingEvent != null) { UpLoadingEvent(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "开始上传个人发票使用记录!\r\n"); } try { BeginTrans( ); for (int invoiceIndex = 0; invoiceIndex < tbInvoice.Rows.Count; invoiceIndex++) { int localInvoiceId = Convert.ToInt32(tbInvoice.Rows[invoiceIndex][Tables.mz_invoice.ID]); MZ_INVOICE mz_invoice = new MZ_INVOICE( ); DataBind <MZ_INVOICE>(tbInvoice.Rows[invoiceIndex], mz_invoice); string strWhere = Tables.mz_invoice.ID + _oleDb.EuqalTo( ) + localInvoiceId; if (BindEntity <MZ_INVOICE> .CreateInstanceDAL(_oleDb).Exists(strWhere)) { BindEntity <MZ_INVOICE> .CreateInstanceDAL(_oleDb).Update(mz_invoice); MSAccessDb.Execute("update mz_invoice set upload_flag = 1 where id = " + localInvoiceId); } else { BindEntity <MZ_INVOICE> .CreateInstanceDAL(_oleDb).Add(mz_invoice); int serverInvoiceId = mz_invoice.ID; MSAccessDb.Execute("update mz_invoice set upload_flag = 1,id = " + serverInvoiceId + " where id = " + localInvoiceId); } } CommitTrans( ); if (UpLoadingEvent != null) { UpLoadingEvent(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "上传个人发票使用记录成功!\r\n发票使用记录" + invoiceCount + "条\r\n\r\n"); } } catch (Exception err) { RollbackTrans( ); throw err; } }